Create timestamp from date and time
BlitzMax Forums/BlitzMax Beginners Area/Create timestamp from date and time
| ||
Hi, I hope somebody can gave me a hint how I can get a timestamp? With CurrentDate and CurrentTime I can get strings but how to combinen to a unix like timestamp and if possible vice versa ... ? Thanks Andre |
| ||
Off the top of me head, google "calculate epoch seconds". Pretty sure that's what you'll need. |
| ||
Function GetTimeStamp:int() local time:int[256] 'fill buffer time_(time) return time[0] End Function Function GetDate:String(format:String="%d.%m.%Y") Local time:Int[256] Local buff:Byte[256] 'fill buffer time_(time) 'format buffer strftime_(buff,256,format,localtime_( time )) Return String.FromCString(buff) End Function just based it on CurrentDate - and added GetDate with overrideable format style. bye Ron |