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.
You can specify the format of the dates in your statements using CONVERT and FORMAT. For example: select convert(varchar(max), DateColumn, 13), format(DateColumn, 'dd-MMM-yyyy')
You case simply use the Year() and Month() functions.
You can use the Now function or Date function to have Access automatically fill in the date or time when a new record is added. Use the Now function to fill in the date and time, or the Date function to fill in just the date.
try using
format
select Format (#05/01/2014#, "mm/dd/yyyy")
more info here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With