B4J Question Date Time to String

Declan

Well-Known Member
Licensed User
Longtime User
Is it possible to convert DateTime to a String format?
I have:
B4X:
Dim MyTime As String = DateTime.now
Log(MyTime)
which returns:
B4X:
1588594976350
How can I get this into a normal text representation"
Something similar to:
B4X:
03 May 2020 11:47:38
 

Declan

Well-Known Member
Licensed User
Longtime User
Got it:
B4X:
    Dim date_string As String
    DateTime.DateFormat = "dd/MM/yyyy"
    DateTime.TimeFormat = "HH:mm:ss"
    date_string=DateTime.Date(DateTime.Now) & " " & DateTime.Time(DateTime.Now)
 
Upvote 0
Top