On 8/30/07, Rick Root <[EMAIL PROTECTED]> wrote: > > http://www.opensourcecf.com/epoch_time.cfm > > I take that back... on my local machine running CF8 on Windows.... the > java method (via getTime()) and the javascript method are the same. > The coldfusion method is different by exactly 5 hours.
Which is how far from GMT I am, I guess. Java is coming up with milliseconds since the java epoch, and it thinks or knows that the server time is UTC time. Coldfusion is doing the same, but thinks the opposite about the server time. > On my server running CFMX7 with Java 1.4.2_11, all three numbers are > different. The java and coldfusion methods are 8 hours off, while the > javascript method and hte java method are 3 hours off. My server is in the pacific time zone, so this makes sense. Again, java returns UTC time, while Coldfusion returns server time... 8 hours apart. And javascript epoch time is based on my browser's timezone, which is 5 hours from UTC.. or GMT or whatever. So it makes sense that server time is 8 hours off, because my server is GMT+8 That being said... I'd go with the java method. It's going to match with the user's browser when adjusted for timezone. So here's how you do it. <cfset myDate = createDate(2007,8,30)> or <cfset myDate = createDateTime(2007,8,30,17,45,0)> then <cfset javaEpoch = int(myDate.getTime()/1000)> javaEpoch now contains the number of seconds since the beginning of the epoch, I think I dealt with this in cfopenchat so that the times displayed to each user would be their local times.. so cfopenchat stores all date time information in the database as UTC time using the dateConvert() function and "local2utc" as the argument value. -- Rick Root Check out CFMBB, BlogCFM, ImageCFC, ImapCFC, CFFM, and more at www.opensourcecf.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287492 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

