Convert string to date

oscarsarrio

Member
Licensed User
Longtime User
Hello would need to convert a string in the format "yyyy-MM-dd hh:mm:ss" to the format "dd/MM/yyyy hh:mm:ss" and I'm thinking to transform date and from there make ... But I have not very clear .... You sure you have it much clearer .... : P ..... :sign0104:
 

MLDev

Active Member
Licensed User
Longtime User
Here's one way to do it:

B4X:
DateTime.DateFormat = "yyyy-MM-dd"
Dim t As Long = DateTime.DateTimeParse("2013-01-28", "15:04:00")
DateTime.DateFormat = "dd/MM/yyyy"
Log(DateTime.Date(t) & " " & DateTime.Time(t))

See SimpleDateFormat for more info on DateFormat.
 
Upvote 0
Top