Lakhtin_V Active Member Licensed User Longtime User Mar 12, 2024 #1 How should a string containing the date and time separately be formatted? I need to convert string date and time values into a long integer in milliseconds that is associated with a time of type 1704..... What separating characters should I use to describe the date and time. So far I'm getting an error all the time. Code: Copy strTime=strH & ":" & strM & ":" & strS strDen=DateTime.Date(DateTime.Now) Log( Sentence & " " & strDen & " " & strTime) Main.GNSSTime = DateTime.DateTimeParse(strDen,strTime)
How should a string containing the date and time separately be formatted? I need to convert string date and time values into a long integer in milliseconds that is associated with a time of type 1704..... What separating characters should I use to describe the date and time. So far I'm getting an error all the time. Code: Copy strTime=strH & ":" & strM & ":" & strS strDen=DateTime.Date(DateTime.Now) Log( Sentence & " " & strDen & " " & strTime) Main.GNSSTime = DateTime.DateTimeParse(strDen,strTime)
Lucas Siqueira Active Member Licensed User Longtime User Mar 12, 2024 #2 use lib dateUtils, native in IDE (B4A, B4I, B4J) Log( DateUtils.SetDateAndTime(2024, 03, 12, 10, 12, 39) ) or DateTime.DateFormat = "MM/dd/yyyy" Log( DateTime.DateTimeParse("03/12/2024","10:12:39") ) Upvote 0
use lib dateUtils, native in IDE (B4A, B4I, B4J) Log( DateUtils.SetDateAndTime(2024, 03, 12, 10, 12, 39) ) or DateTime.DateFormat = "MM/dd/yyyy" Log( DateTime.DateTimeParse("03/12/2024","10:12:39") )