B4J Question Weird Date

Declan

Well-Known Member
Licensed User
Longtime User
I have the following code that writes the Date to a mySQL DB:
B4X:
            Dim myID As String = deviceID
            Dim myDate As String
            DateTime.DateFormat = "dd/mm/yyyy"
            myDate = DateTime.Date(DateTime.Now)
            SQL.ExecNonQuery2("INSERT INTO regdevices (deviceid, regdate) VALUES (?, ?)", Array(myID, myDate))

However, the date that is returned is:
B4X:
04/30/2026

Month is dodgy
Should be: 04/01/2026
 
Top