One way to format a datetime for sql is:
Format({date expression}, "\#mm/dd/yyyy hh:nn:ss\#")
However I came across this page which shows a different and rather bizarre alternative.
http://www.mvps.org/access/datetime/date0005.htm
This string makes no sense to me at all:
"\#mm\/dd\/yyyy hh\:nn\:ss\#;;;\N\u\l\l"
This definitely works but must include that weird bit on the end if the forward slashes and colons are (presumably) escaped with the backslashes like that. Unfortunately it is not explained at all on the page.
The ending looks a lot like an ofcuscated Null to me and what is with the three semicolons? Moreover why use this when the simple alternative works? Is it a version thing?
The simple string Googles 63K hits while the other produces just four, one being the mvps page I have already linked and three asking for help with problems. Unfortunately the mvps page has a very high page rank and no doubt confuses many people.
Unfortunately I have just given it more status at Google.
Format({date expression}, "\#mm/dd/yyyy hh:nn:ss\#")
However I came across this page which shows a different and rather bizarre alternative.
http://www.mvps.org/access/datetime/date0005.htm
This string makes no sense to me at all:
"\#mm\/dd\/yyyy hh\:nn\:ss\#;;;\N\u\l\l"
This definitely works but must include that weird bit on the end if the forward slashes and colons are (presumably) escaped with the backslashes like that. Unfortunately it is not explained at all on the page.
The ending looks a lot like an ofcuscated Null to me and what is with the three semicolons? Moreover why use this when the simple alternative works? Is it a version thing?
The simple string Googles 63K hits while the other produces just four, one being the mvps page I have already linked and three asking for help with problems. Unfortunately the mvps page has a very high page rank and no doubt confuses many people.
Unfortunately I have just given it more status at Google.