Android Question DateTime

Peekay

Active Member
Licensed 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
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

toby

Active Member
Licensed User
B4X:
Dim cmd As DBcommand = CreateCommand("sendmessagefromsite",Array(DateTime.now, AndroidID, Message))
 
Upvote 0

aeric

Expert
Licensed User
B4X:
DateTime.DateFormat = "yyyy-MM-dd"
DateTime.TimeFormat = "HH:mm:ss"                   
Dim ThisDateTime As Long = DateTime.Now
 
Upvote 0

aeric

Expert
Licensed 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