Making formatDateTime() and readDate() ... from KLocale timezone aware

David Jarvie lists at
Tue Aug 14 18:06:24 BST 2007

On Tuesday 14 August 2007 16:30, Bruno Virlet wrote:
> So we would like to have in KLocale:
> - formatDate, formatTime and formatDateTime(QDateTime) with an optional
> KDateTime::Spec argument. If specified and if this spec is not the local
> one,
> the timezone is appended to the returned string.
> But how should this be done regarding to timeFormat, dateFormat strings ?

Rather than add optional KDateTime::Spec arguments, I think it would be
better for the caller to transform the QDateTime into a KDateTime and then
to call the KDateTime variants of these methods. Generally speaking, when
time zones are being used, KDateTime should be used in preference to
QDateTime, so this in theory shouldn't be needed too much.

> - formatDateTime(KDateTime) as a little issue because it supports timezone
> thanks to an option, but if the KDateTime is date only, it calls
> formatDate
> which doesn't support timezone, which will return a date string without
> timezone which is incorrect.

This ought to be fixed - I'll look at it.

David Jarvie.
KAlarm author & maintainer.

More information about the kde-core-devel mailing list