Date or Date-and-time for transactions

Derek Atkins warlord at MIT.EDU
Fri Nov 30 10:09:37 EST 2012


John Ralls <jralls at ceridwen.us> writes:

>> As you say, the dates are stored as ISO8601, or converted from local
>> time to UTC.  So I think even in a multi-user environment we're fine,
>> because datetimes will either have a local timezone or be converted to
>> UTC and therefore end up in the correct order.
>
> Right. Since ISO8601 specifies that date-times are converted to UTC
> (Z), we currently convert to-and-from the local TZ when we instantiate
> objects with a Timespec field. I'm saying we should stop doing that
> and just use UTC for timestamps. This has the added benefit of making
> unnecessary the GTimeZone workarounds for MSWin, all of the messiness
> associated with DST, and a boatload of code.

Actually, the XML file stores times as local times.  Here's an example
from my data file:

  <trn:date-posted>
    <ts:date>2007-01-01 00:00:00 -0500</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2007-08-13 15:15:22 -0400</ts:date>
  </trn:date-entered>

And it looks like it uses 00:00:00 as the base post time, not 12:00:00.

But yes, we can (and possibly should) ignore the time/tz of the post
time and just take the date (2007-01-01 in the above example).

>>>> IMHO the Post Date should be an actual Date, and not a Timespec.  But
>>>> changing the data format is -- challenging.  ;)
>>> 
>>> Actually, the stored date format is an ISO8601 date-time string, so we
>>> can do whatever we want for an internal representation.
>> 
>> The issue is semantics.  How do we know whether a data file is using the
>> old interpretation or the new interpretation of a timestamp for the Post
>> Date?
>
> ATM, we store YYYY-MM-DD 12:00:00Z. For backwards compatibility, I
> suppose we should continue to do so.  The change will be that
> internally we'll just make a GDate from it.

I think we only do this in the SQL backend.  We don't in XML.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list