How to convert a string from Json to Ms Access date & time

nector

Member
Local time
Today, 23:56
Joined
Jan 21, 2020
Messages
462
Hello there!

Can someone help me to convert this date/time string to normal date:

String : 20230626121231

I want a function to convert the above string to look like this : 2023/06/26 12:12:31

Kindly try it in Ms Access before posting , I tried this function below it failed:

Format(20230626121231, "mm/dd/yyyy hh:hh:ss am/pm")
 
Did you try enclosing the string with double quotes?
 
Actual that is coming from a control called invoicedate
 
Code:
DateValue = CDate(Format("20230626121231", "@@@@-@@-@@ @@:@@:@@"))
xyz = Format(DateValue, "mm\/dd\/yyyy hh:nn:ss am/pm")
 
Josef P.

The code is giving an error called overflow runtime 6:

Code:
Me.txtEsd = Format(DLookup("EsDTime", "tblEfdReceipts", "INVID =" & [InvoiceID]), "mm/dd/yyyy hh:hh:ss am/pm")
 
Last edited:
nector,

This format is incorrect "mm/dd/yyyy hh:hh:ss am/pm"
should be nn for minutes
 
202306261231 is not a number corresponding to a date value. Therefore you can't convert it with "mm/dd/yyyy ...".

Have you tried the code I gave you?
 
nector,

This format is incorrect "mm/dd/yyyy hh:hh:ss am/pm"
should be nn for minutes
nector,

This format is incorrect "mm/dd/yyyy hh:hh:ss am/pm"
should be nn for minutes


Code:
Me.txtEsd = Format(DLookup("EsDTime", "tblEfdReceipts", "INVID =" & [InvoiceID]), "mm/dd/yyyy hh:nn:ss am/pm")

Im still getting the same message


Runtime 6 overflow.png
 
See Josef's answer in #7
 

Users who are viewing this thread

Back
Top Bottom