February 20, 2005

universal time

all this poking and prodding into cf's datetime i did lately shone a bright light on the usefulness of something like icu4j's universal time class. if you have to swap back and forth between time scales (for instance some java classes require a long instead of a date type) or even if you do "simple" date manipulations (say averaging two java datetimes could cause overflow even with current dates), you've got good candidates for using universal time. to make a long story short, i built a universalTime CFC to help handle this. below is some output from this CFC (we'd normally have a testbed on our site but for some reason this class won't load via spike's remote classpath technique):
time:= {ts '2005-02-20 16:56:03'}
cf epoch:=38403.7055903 (days since 31-dec-1899)
universal time from cf time:=632,447,745,630,000,000
universal time to cf time:= 38403.7055903

coldfusion timescale:=38403.7055903 (days since 31-dec-1899)
excel timescale:=38403.7055903 (days since 31-dec-1899)
db2 timescale:=38403.7055903 (days since 31-dec-1899)
windows timescale:=6.3244774563E+017 (ticks (100 nanoseconds) since 1-jan-0001)
windowsfile timescale:=1.2753478563E+017 (ticks (100 nanoseconds) since 1-jan-1601)
mac timescale:=130697763 (second since 1-jan-2001)
oldmac timescale:=3191849763 (seconds since 1-jan-1904)
unix timescale:=1109005407 (seconds since 1-jan-1970)
java timescale:=1.109004963E+012 (milliseconds since 1-jan-1970)

the CFC will be in the usual places in a bit.


Post a Comment

<< Home