Converting date time format to mm/dd/yyy format

bknight
BronzeLounger
Posts: 1391
Joined: 08 Jul 2016, 18:53

Converting date time format to mm/dd/yyy format

Post by bknight »

I've got a day/time field that I would like to convert to mm/dd/yyyy format in a grouping query. Tradedate: Int(Day([NinjaTrader2024_PA].[Time])) and I received a group of days. So I'd like the specific format mm/dd/yyyy. Is there a format instead of concat 3 date/times with 2 "/" between them?

bknight
BronzeLounger
Posts: 1391
Joined: 08 Jul 2016, 18:53

Re: Converting date time format to mm/dd/yyy format

Post by bknight »

Never mind I just removed the Day and got a m/dd/yyyy format which should be fine. Tradedate: Int(([NinjaTrader2024_PA].[Time])) formatting the field to short date.

User avatar
Gasman
2StarLounger
Posts: 104
Joined: 22 Feb 2022, 09:04

Re: Converting date time format to mm/dd/yyy format

Post by Gasman »

I used to use this format constant for my dates.

Code: Select all

Public Const strcJetDate = "\#yyyy-mm-dd\#"  'Needed for dates in queries as Access expects USA but will accept ISO format.
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.

bknight
BronzeLounger
Posts: 1391
Joined: 08 Jul 2016, 18:53

Re: Converting date time format to mm/dd/yyy format

Post by bknight »

Gasman wrote:
24 Feb 2024, 20:54
I used to use this format constant for my dates.

Code: Select all

Public Const strcJetDate = "\#yyyy-mm-dd\#"  'Needed for dates in queries as Access expects USA but will accept ISO format.
Will that expression work in a query?

User avatar
Gasman
2StarLounger
Posts: 104
Joined: 22 Feb 2022, 09:04

Re: Converting date time format to mm/dd/yyy format

Post by Gasman »

I don't know, let me check.

No.

I actually only ever used it for VBA.
Then again a simple "mm/dd/yyyy" works in queries, so the complexity is never needed in queries, just in VBA?
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.