Date conversion

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!!!
 
R

RoyVidar

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)
 
A

Allen Browne

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top