Date Format

junaidahmed

Well-Known Member
Licensed User
Longtime User
How to Change below String to Data Format as YYYY-MM-DD HH:MM

Dim StrDate as String

StrDate = "16-05-2011"
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Here:
B4X:
    DateTime.DateFormat = "dd-MM-yyyy"
    Dim t As Long
    t = DateTime.DateParse("16-05-2011")
    DateTime.DateFormat = "yyyy-MM-dd HH:mm"
    Dim s As String
    s = DateTime.Date(t)

Note that the case of the format characters is important. See this page for the meaning of each character: SimpleDateFormat (Java 2 Platform SE v1.4.2)
 
Upvote 0
Top