Time Conversion Problem

Sarah Reichelt sarah.reichelt at gmail.com
Thu Jan 17 19:23:03 EST 2008


> I am reading a file that contains date and time data. The Date/Time
> is represented as a 4 byte integer and is defined as the number of
> seconds since 1/1/1904 (Apple Date/Time format). Does anyone know if
> there is a way to convert this to a displayable format, e.g.
> "Thursday, January 17, 2008 1:35 PM". If there isn't a way of doing
> this in RunRev, does anyone know how to go about doing this?

This will need testing, but I think HyperCard used the 1904 starting
date for it's seconds, so my old HyperCard to Rev function should
work:

function HCtoRevSeconds pSecs
  if pSecs is empty OR pSecs is not a number
  then return the seconds
  put pSecs - 2082880800 into revSecs
  return revSecs
end HCtoRevSeconds

Then you have the date & time in Rev seconds and you can format it
using the usual methods. From your example, you could use something
like this:

put HCtoRevSeconds(tFileTime) into tRevTime
convert tRevTime to long system date and short system time

Cheers,
Sarah



More information about the use-livecode mailing list