New topic: Seconds since Epoch
<http://forums.realsoftware.com/viewtopic.php?t=42429> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message jeremy_c Post subject: Seconds since EpochPosted: Sat Jan 28, 2012 1:59 pm Joined: Thu Jul 12, 2007 3:38 pm Posts: 90 Location: Norton, Ohio I am having to deal with unix time numbers that represent the number of seconds since epoch. Is there an easy way to convert this number into a value usable with the TotalSeconds property of a Date object? _________________ Jeremy Real Studio Enterprise, 2011r4 Top pixe656 Post subject: Re: Seconds since EpochPosted: Sat Jan 28, 2012 4:25 pm Joined: Wed May 20, 2009 11:02 am Posts: 270 First, I have to say that I read about Epoch for the first time in my life in your post, so what I am saying here might be completely wrong. RealBasic total seconds are: Quote:The number of seconds since 12:00AM, January 1, 1904. And Unix (Epoch) time is: Quote:is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT) (http://www.epochconverter.com/) Thus, in order to get the RB totalseconds of a unix time, you need to add the totalseconds difference between the RB 0 time and the unix 0 time to that unix time, i.e.: MyDateInRBformat.TotalSeconds=UnixTime+EpochDateAndTimeInRBFormat.TotalSeconds Where EpochDateAndTimeInRBFormat corresponds to January 1, 1970, 00:00h. Also, you should take into account that Epoch time is UTC/GMT time, so you may need to adjust it to your time zone. Pixe _________________ Using RS2011r2 on Windows7. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
