Create timestamp from date and time

BlitzMax Forums/BlitzMax Beginners Area/Create timestamp from date and time

andre72(Posted 2012) [#1]
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


GfK(Posted 2012) [#2]
Off the top of me head, google "calculate epoch seconds". Pretty sure that's what you'll need.


Derron(Posted 2012) [#3]
	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