Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 1 of 1 total
Thread EncodeDate(y,m,d) -> use EncodeDateTime(y,m,d,0,0,0,0)
Sat, Nov 9 2013 9:05 AMPermanent Link

Walter Matte

Tactical Business Corporation

In case anyone else bumps into this, maybe it will save you time...

dt : DateTime;

dt := EncodeDate(2013,11,9);

I thought the time part would be 0:00.00.000  but it takes the current time as at the EncodeDate moment and add's it to your date.....

I've recommend to Tim that he change the EncodeDate routine to be

function encodedate($0, $1, $2, $3)
  if ($3)
     return new Date(Date.UTC($0, $1 - 1, $2, 0, 0, 0, 0)).getTime();
     return new Date($0, $1 - 1, $2, 0, 0, 0, 0).getTime();

but it is easy just to never use EncodeDate but use EncodeDateTime to fix this problem:

dt := EncodeDateTime(2013,11,9,0,0,0,0);

Don't forget there is still a bug in EncodeDateTime 1.02 B2 - that is fixed for next build... if you use UTC

dt := EncodeDateTime(2013,11,9,0,0,0,0, True);

Work around is subtracting one from you month until the next build....Frownust for UTC).

dt := EncodeDateTime(2013,11 - 1,9,0,0,0,0, True);