Android Question how can i return the current date and time on my computer

Makumbi

Well-Known Member
Licensed User
going morning iam currently having 12/04/2020 09:51:15 AM

my current code
returns only 12/04/2020 yet i wanted to return the date and time as it is with PM Or AM correspondingly this is because in my sqlite database i have a datetime field where i would want to store the exact date and time stamp as it is . please help th
B4X:
Sub  getdate(gt As String)
    Dim lt As Long
    DateTime.DateFormat = "dd/MM/yyyy" ' "1961-08-29"
    Dim datestring As String = DateTime.Date(JsonDateToTick( gt))
    lt = DateTime.DateParse(datestring)
    DateTime.DateFormat = "dd/MM/yyyy"
    Log(DateTime.Date(lt))
    gt=DateTime.Date(lt)
    'Return
End Sub
 

Mahares

Expert
Licensed User
Longtime User
where i would want to store the exact date and time stamp as it is .
Bonjour Makumbi:
B4X:
DateTime.DateFormat = "dd/MM/yyyy hh:mm:ss a"    '12/04/2020 09:51:15 AM
    Dim lt As Long = DateTime.DateParse("12/04/2020 09:51:15 AM")
    Dim gt As String = DateTime.Date(lt)
    Log(gt)    'displays: 12/04/2020 09:51:15 AM
 
Upvote 0
Top