StackTrace
StackTrace

Reputation: 9416

How to format dates in microsoft access queries

SELECT convert(varchar, getdate(), 101)

In Microsoft SQL Server, the above query returns the current date in the format

mm/dd/yyyy - 05/01/2014

What is its Microsoft Access query equivalent? I have tried CDate(MyDateValue) but this does not retain leading zeroes. In the example above, it returns

5/1/2014

but i need the leading zeroes.

Upvotes: 6

Views: 30583

Answers (2)

Twin Tower
Twin Tower

Reputation: 30

Try this select convert(date,getdate(),101)

Upvotes: -2

vhadalgi
vhadalgi

Reputation: 7189

try using

format

select Format (#05/01/2014#, "mm/dd/yyyy") 

more info here

Upvotes: 12

Related Questions