Split date in day, month and year inside query (1 Viewer)

gstylianou

Registered User.
Local time
Today, 23:25
Joined
Dec 16, 2013
Messages
357
I need a query so to split the date 18/01/2023 to day=18 , month=01 and year=2023 within query. Can anyone help?
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:25
Joined
Sep 21, 2011
Messages
14,310
Yes. Use the functions that have those exact names? :(
 

gstylianou

Registered User.
Local time
Today, 23:25
Joined
Dec 16, 2013
Messages
357
Yes. Use the functions that have those exact names? :(
The table name is Dates, the date as above field is the [Month_Date] which is date format (short date)

How can i split it?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:25
Joined
May 7, 2009
Messages
19,245
as in post #2:

copy/paste to query designer (SQL view):

Select Day([Month_Date]) As D, Month([Month_Date]) As M, Year([Month_Date]) As Y From Dates
 

gstylianou

Registered User.
Local time
Today, 23:25
Joined
Dec 16, 2013
Messages
357
Thank you very much, working fine. Another one question,

I'm trying to make time table with time slots every 15min Starting from 00:00 Ends On 23:45. If there is a way to do it using vba?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:25
Joined
May 7, 2009
Messages
19,245
i create TimeT table and from that table created TimeSlotQ query.
 

Attachments

  • timeSlot.accdb
    408 KB · Views: 61

Minty

AWF VIP
Local time
Today, 21:25
Joined
Jul 26, 2013
Messages
10,371
Create a lookup table with the time slots in it.
1679577399479.png
1679577438049.png


Having the slots in a table will make you life much easier.
You can probabaly create in excel using autofill and paste them in.
 

gstylianou

Registered User.
Local time
Today, 23:25
Joined
Dec 16, 2013
Messages
357
Is there is a way to take the day name using sql query? Lets say today is 23/03/2023 to take Thursday?
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:25
Joined
Sep 21, 2011
Messages
14,310
Is there is a way to take the day name using sql query? Lets say today is 23/03/2023 to take Thursday?
I have Google on this phone.

Found via
 

Users who are viewing this thread

Top Bottom