Date conversion

  • Thread starter Thread starter Domac
  • Start date Start date
D

Domac

Hi!

How to convert european (also used in Croatia) date format (result of Now()
function)

dd.mm.yyyy hh:mm:ss

into "american" format

mm/dd/yyyy hh:mm:ss


thanks!!!
 
Domac wrote in message said:
Hi!

How to convert european (also used in Croatia) date format (result
of Now() function)

dd.mm.yyyy hh:mm:ss

into "american" format

mm/dd/yyyy hh:mm:ss


thanks!!!

Here are two links
http://www.mvps.org/access/datetime/date0005.htm
http://allenbrowne.com/ser-36.html

The last one with some interesting explanations.

I use ISO 8601
format$(now(), "yyyy-mm-dd")
format$(now(), "yyyy-mm-dd hh:nn:ss")

Note - the only place this should be relevant, is when building
dynamic sql strings (to open recordsets, execute queries,
wherecondition of openform/openreport or usage of the domain aggregate
functions)
 
See:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html

Since you want the time as well as the date, use:

Function SQLDateTime(varDate As Variant) As String
If IsDate(varDate) Then
SQLDateTime = "#" & Format$(varDate, "mm\/dd\/yyyy hh\:nn\:ss")
& "#"
End If
End Function
 
Back
Top