Peekay Active Member Licensed User Longtime User Jul 9, 2020 #1 How do I get the date and time (now) in the correct format for insertion into a datetime field in Sql Server? Thanks PK
How do I get the date and time (now) in the correct format for insertion into a datetime field in Sql Server? Thanks PK
Erel B4X founder Staff member Licensed User Longtime User Jul 9, 2020 #2 If you are using jRDC2 then you should send the ticks value (Long). Upvote 0
Peekay Active Member Licensed User Longtime User Jul 9, 2020 #3 This code does not work: (can you please help): Code: 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" Click to expand... Last edited: Jul 9, 2020 Upvote 0
This code does not work: (can you please help): Code: 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" Click to expand...
toby Well-Known Member Licensed User Longtime User Jul 9, 2020 #4 B4X: Dim cmd As DBcommand = CreateCommand("sendmessagefromsite",Array(DateTime.now, AndroidID, Message)) Upvote 0
B4X: Dim cmd As DBcommand = CreateCommand("sendmessagefromsite",Array(DateTime.now, AndroidID, Message))
eps Expert Licensed User Longtime User Jul 9, 2020 #5 As in Microsoft SQL Server? How is the field defined in your DB? Upvote 0
aeric Expert Licensed User Longtime User Jul 9, 2020 #6 B4X: DateTime.DateFormat = "yyyy-MM-dd" DateTime.TimeFormat = "HH:mm:ss" Dim ThisDateTime As Long = DateTime.Now Upvote 0
B4X: DateTime.DateFormat = "yyyy-MM-dd" DateTime.TimeFormat = "HH:mm:ss" Dim ThisDateTime As Long = DateTime.Now
Peekay Active Member Licensed User Longtime User Jul 9, 2020 #7 eps said: As in Microsoft SQL Server? How is the field defined in your DB? Click to expand... Yes, MS Sql Server. It is defined as datetime Upvote 0
eps said: As in Microsoft SQL Server? How is the field defined in your DB? Click to expand... Yes, MS Sql Server. It is defined as datetime
aeric Expert Licensed User Longtime User Jul 9, 2020 #8 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
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)
Erel B4X founder Staff member Licensed User Longtime User Jul 9, 2020 #9 Peekay said: This code does not work: (can you please help): Click to expand... You are not working with date / time values correctly. I recommend you to watch the date & time video tutorial: https://www.b4x.com/etp.html Upvote 0
Peekay said: This code does not work: (can you please help): Click to expand... You are not working with date / time values correctly. I recommend you to watch the date & time video tutorial: https://www.b4x.com/etp.html
M Mahares Expert Licensed User Longtime User Jul 9, 2020 #10 Peekay said: Yes, MS Sql Server. It is defined as datetime Click to expand... Code: Dim ThisDateTime As String DateTime.DateFormat="yyyy-MM-dd HH:mm:ss" ThisDateTime = DateTime.date(DateTime.Now) Log(ThisDateTime) 'displays: 2020-07-09 07:36:24 of course current Upvote 0
Peekay said: Yes, MS Sql Server. It is defined as datetime Click to expand... Code: Dim ThisDateTime As String DateTime.DateFormat="yyyy-MM-dd HH:mm:ss" ThisDateTime = DateTime.date(DateTime.Now) Log(ThisDateTime) 'displays: 2020-07-09 07:36:24 of course current
Peekay Active Member Licensed User Longtime User Jul 9, 2020 #11 I think I have the datetime right. Thanks guys. Upvote 0