B Bernd68 Member Licensed User Longtime User Mar 23, 2012 #1 I get a strange result, when i try to convert an Epoch Timestamp. Using this code Code: Copy Dim Starttime As Long Dim StartTimeText As String DateTime.TimeFormat = "mm/dd/yy hh:mm:ss" Starttime = 1332534073 StartTimeText = DateTime.Time(Starttime*1000) Log("EPOCH converted to: "& StartTimeText) I get the follwing result in the LogViewer: EPOCH converted to: 21/23/12 09:21:13 The Time is correct, but the Date is wrong. Do i miss something here ? Bernd
I get a strange result, when i try to convert an Epoch Timestamp. Using this code Code: Copy Dim Starttime As Long Dim StartTimeText As String DateTime.TimeFormat = "mm/dd/yy hh:mm:ss" Starttime = 1332534073 StartTimeText = DateTime.Time(Starttime*1000) Log("EPOCH converted to: "& StartTimeText) I get the follwing result in the LogViewer: EPOCH converted to: 21/23/12 09:21:13 The Time is correct, but the Date is wrong. Do i miss something here ? Bernd
thedesolatesoul Expert Licensed User Longtime User Mar 23, 2012 #2 The format for month is MM not mm(minutes) Sent from my GT-I9000 using Tapatalk Upvote 0
B Bernd68 Member Licensed User Longtime User Mar 23, 2012 #3 Got it :BangHead: Thx for the quick answer Upvote 0
thedesolatesoul Expert Licensed User Longtime User Mar 23, 2012 #4 Was on the train Sent from my GT-I9000 using Tapatalk Upvote 0
B Bernd68 Member Licensed User Longtime User Mar 23, 2012 #5 One more question How would i calculte the EPOCH timestamp with B4A Does anyone already have a solution for it? Rgds Bernd Upvote 0
One more question How would i calculte the EPOCH timestamp with B4A Does anyone already have a solution for it? Rgds Bernd
thedesolatesoul Expert Licensed User Longtime User Mar 23, 2012 #6 Datetime.Now Sent from my GT-I9000 using Tapatalk Upvote 0
B Bernd68 Member Licensed User Longtime User Mar 24, 2012 #7 DateTime Format Problem It is right for "Now". But, how would it be possible for a given Date? I tried the following code: Code: Copy DateTime.DateFormat = "MM/dd/yy hh:mm:ss H" Dim UTC_TS As Long UTC_TS = DateTime.DateParse("03/23/2012 19:30:00") - DateTime.DateParse("01/01/1970 00:00:00") Log("UTC_TS: "&UTC_TS) But this throws an ParseExeption "Unparsable Date", because of "H" in the DateFormat. Following the THIS Documentation Link for "Formats", this should be allowed. Looking for a solution to get the UTC Timestamp for a given Date & Time for an 24h Format Any ideas? Rgds Bernd Upvote 0
DateTime Format Problem It is right for "Now". But, how would it be possible for a given Date? I tried the following code: Code: Copy DateTime.DateFormat = "MM/dd/yy hh:mm:ss H" Dim UTC_TS As Long UTC_TS = DateTime.DateParse("03/23/2012 19:30:00") - DateTime.DateParse("01/01/1970 00:00:00") Log("UTC_TS: "&UTC_TS) But this throws an ParseExeption "Unparsable Date", because of "H" in the DateFormat. Following the THIS Documentation Link for "Formats", this should be allowed. Looking for a solution to get the UTC Timestamp for a given Date & Time for an 24h Format Any ideas? Rgds Bernd
thedesolatesoul Expert Licensed User Longtime User Mar 24, 2012 #8 You are not following the format in dateparse that you set yourself in the line above. Sent from my GT-I9000 using Tapatalk Upvote 0
You are not following the format in dateparse that you set yourself in the line above. Sent from my GT-I9000 using Tapatalk
B Bernd68 Member Licensed User Longtime User Mar 24, 2012 #9 Yes i saw it, and changed it as following Code: Copy DateTime.DateFormat = "MM/dd/yy hh:mm:ss H" Dim UTC_TS As Long UTC_TS = DateTime.DateParse("03/23/2012 19:30:00 H") - DateTime.DateParse("01/01/1970 00:00:00 H") Log("UTC_TS: "&UTC_TS) But still throws an ParseExeption "Unparsable Date". Do i miss something ? Upvote 0
Yes i saw it, and changed it as following Code: Copy DateTime.DateFormat = "MM/dd/yy hh:mm:ss H" Dim UTC_TS As Long UTC_TS = DateTime.DateParse("03/23/2012 19:30:00 H") - DateTime.DateParse("01/01/1970 00:00:00 H") Log("UTC_TS: "&UTC_TS) But still throws an ParseExeption "Unparsable Date". Do i miss something ?
thedesolatesoul Expert Licensed User Longtime User Mar 24, 2012 #10 DateTime.Dateformat = "MM/dd/yyyy HH:mm:ss" And cut out the H from the parse string. Sent from my GT-I9000 using Tapatalk Upvote 0
DateTime.Dateformat = "MM/dd/yyyy HH:mm:ss" And cut out the H from the parse string. Sent from my GT-I9000 using Tapatalk