Android Question DateTime

Peekay

Active Member
Licensed User
Longtime User
How do I get the date and time (now) in the correct format for insertion into a datetime field in Sql Server?
Thanks
PK
 

Peekay

Active Member
Licensed User
Longtime User
This code does not work: (can you please help):

date time:
Dim ThisDateTime As Long
DateTime.DateFormat="dd-MMM-yy HH:mm"
ThisDateTime = DateTime.TimeParse(DateTime.Now)
Dim cmd As DBcommand = CreateCommand("sendmessagefromsite",Array(ThisDateTime, AndroidID, Message))

java.text.ParseException: Unparseable date: "1594278402264"
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
B4X:
    DateTime.DateFormat = "yyyy-MM-dd"
    DateTime.TimeFormat = "HH:mm:ss"
    Dim ThisDateTime As Long = DateTime.Now
    Dim strDateTime As String = DateTime.Date(ThisDateTime) & " " & DateTime.Time(ThisDateTime)
    Log(strDateTime)
 
Upvote 0
Top