Bruce, enclosed are 2 jpg's showing the date and time calcs, one at 4:12pm PDT and one at 5:03pm PDT. The second has the errors as the 7 hour time difference from UTC puts the UTC time into the next day, but the calculated UTC date is incorrect. Here's the code that shows the calcs and variables displayed in the jpg's. Just look at the UTC variables. I started to fiddle with compensating for the error, but haven't thought it all through yet. Thanks,Mark
LOC:UTCTimeStamp = pTimeStamp/1000 ! convert to long, no milliseconds
LOC:UTCDate = p_web.UnixToClarionDate(LOC:UTCTimeStamp)
LOC:UTCTime = p_web.UnixToClarionTime(LOC:UTCTimeStamp)
LOC:UTCDateString = Format(LOC:UTCDate,@d2)
LOC:UTCTimeString = Format(LOC:UTCTime,@t3)
LOC:Date = LOC:UTCDate
!! adjust to local time zone (PDT for now)
LOC:TimeZoneAdjustment = -7
LOC:Time = LOC:UTCTime + (LOC:TimeZoneAdjustment * 100*60*60)
IF LOC:Time < 0
LOC:Date -= 1
LOC:Time = LOC:UTCTime + ((24 - ABS(LOC:TimeZoneAdjustment) * 100*60*60))
ELSIF LOC:Time > (100*60*60*24)
LOC:Date += 1
LOC:Time -= (100*60*60*24)
END
! testing display
LOC:DateString = Format(LOC:Date,@d2)
LOC:TimeString = Format(LOC:Time,@t3)