DateTime.DateFormat = $"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"$
Dim dt_long As Long = DateTime.DateParse("2022-12-13T13:05:37.503Z")
Log(dt_long)
Log(DateTime.Date(dt_long))
No time zone!
When I use DateTime.DateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" I get: "Error: (ParseException) java.text.ParseException: Unparseable date: "2023-04-18T05:18:19.994Z"
Dear All, Greetings How can I Get Date & Time of Other Country ? i.e. : make this code to return back the date and time of other country not my current mobile clock DateTime.DateFormat = "dd MMM yyyy" Label1.Text = DateTime.Date(DateTime.now) Thanks on advance.
DateTime.DateFormat = $"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"$ ' <-- OK
'DateTime.DateFormat = $"yyyy-MM-dd'T'HH:mm:ss.SSSZ"$ ' <-- Error
Dim dt_long As Long = DateTime.DateParse("2023-04-18T14:45:37.503Z")
Log(dt_long)
Log(DateTime.Date(dt_long))
DateTime.DateFormat = $"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"$ ' <-- OK
'DateTime.DateFormat = $"yyyy-MM-dd'T'HH:mm:ss.SSSZ"$ ' <-- Error
Dim dt_long As Long = DateTime.DateParse("2023-04-18T14:45:37.503Z")
Log(dt_long)
Log(DateTime.Date(dt_long))
In DateFormat String, the strings enclosed with single quotes will be treated as original strings and not parsed, it will display 2023-04-18T14:45:37.503Z without zone
The format cannot use for parsing as Long but can be use to format the date as String.
B4X:
DateTime.DateFormat = $"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"$ ' <-- OK
'DateTime.DateFormat = $"yyyy-MM-dd'T'HH:mm:ss.SSSZ"$ ' <-- Error when Parsing
Dim dt_long As Long = DateTime.DateParse("2023-04-18T15:13:37.503Z")
Log(dt_long)
Log(DateTime.Date(dt_long))
DateTime.DateFormat = $"yyyy-MM-dd'T'HH:mm:ss.SSSZ"$ ' <-- OK when formatting
Log(DateTime.Date(dt_long))