New topic: Unix Timestamp
<http://forums.realsoftware.com/viewtopic.php?t=21604> Page 1 of 1 [ 6 posts ] Previous topic | Next topic Author Message briansykes Post subject: Unix TimestampPosted: Wed Apr 02, 2008 12:23 pm Joined: Sun Mar 23, 2008 10:54 am Posts: 178 Hi there, i need to convert a unix timestamp into a readable time and date i looked at the LR entry for Date class and it doesn't exactly tell me anything useful at all an example of the unix timestamp is this.1207158763 A 10 digit timestamp, Any help in understanding this would be excellent and very much appreciated. Top jens bendig Post subject: Re: Unix TimestampPosted: Wed Apr 02, 2008 12:36 pm Joined: Tue Mar 06, 2007 11:01 am Posts: 1012 Location: Bremen, Germany Hi Brian, it seems to be a counter for a numer of seconds since January 1, 1970: http://en.wikipedia.org/wiki/Unix_timestamp Top briansykes Post subject: Re: Unix TimestampPosted: Wed Apr 02, 2008 12:38 pm Joined: Sun Mar 23, 2008 10:54 am Posts: 178 I know what it is and why its there, i just have no clue how to make it into a readable time and date. Top Steve Garman Post subject: Re: Unix TimestampPosted: Wed Apr 02, 2008 12:53 pm Joined: Fri Sep 30, 2005 3:53 pm Posts: 3261 Location: England Despite your rudeness to Jens who was being very helpful, I'll offer you this functionFunction rbFromUnixStamp(Timestamp as Double) As Date dim d as new date d.TotalSeconds = 2082880816 + Timestamp Return d End Function which you call asdim dat as date = rbFromUnixStamp( 1207158763 ) MsgBox dat.SQLDateTime // 2008-04-03 03:52:59 _________________ Steve Garman Using REALbasic 2008r2 Professional on Windows Vista Ultimate and REALbasic 2009r5.1 Professional on Linux Ubuntu 9.04 Desktop and REAL Studio 2010r1 Personal on Linux Ubuntu 9.10 Desktop Occasional blog Top briansykes Post subject: Re: Unix TimestampPosted: Wed Apr 02, 2008 2:46 pm Joined: Sun Mar 23, 2008 10:54 am Posts: 178 I apologize if that looked rude but i meant nothing by it perhaps i could have worded it better i was just stating a fact, thats all. I'm sorry for any insults i may have put forth. Also thank you very much for your help in this matter. Top Akiland Post subject: Re: Unix TimestampPosted: Wed Mar 13, 2013 7:11 am Joined: Tue Jan 04, 2011 3:02 am Posts: 1162 Location: Jönköping, Sweden Steve Garman wrote:Despite your rudeness to Jens who was being very helpful, I'll offer you this functionFunction rbFromUnixStamp(Timestamp as Double) As Date dim d as new date d.TotalSeconds = 2082880816 + Timestamp Return d End Function which you call asdim dat as date = rbFromUnixStamp( 1207158763 ) MsgBox dat.SQLDateTime // 2008-04-03 03:52:59 Thank you Steve, just what I needed _________________ http://www.linkedin.com/in/albinkiland Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8 REAL.Studio Web Edition 2011r3 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 6 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]
