impossible to get year in format date (1 Viewer)

ryprobg

Member
Local time
Today, 06:35
Joined
Sep 3, 2022
Messages
59
hello:
i use this formula in an access query to get year/mounth and [deb] is my date field in the table
expr1: Format([deb];"""yyyy""/mm") but when i execute the query i get the result shown in the picture below
i use frensh windows and the language of my computer is frensh / format of deb field ( Date, abrégé)
how can i get year/mounth with a correct formula? IMG_20220911_181031.jpg
 

ryprobg

Member
Local time
Today, 06:35
Joined
Sep 3, 2022
Messages
59
expr1: Format([deb]; "yyyy/mm")
yes this is what i use expr1: Format([deb]; "yyyy/mm") but give just the result in the picture below
 

Attachments

  • IMG_20220911_181031.jpg
    IMG_20220911_181031.jpg
    4.5 MB · Views: 79

cheekybuddha

AWF VIP
Local time
Today, 06:35
Joined
Jul 21, 2014
Messages
2,321
That's not what you wrote in your original post.

You wrote: expr1: Format([deb];"""yyyy""/mm")

I wrote: expr1: Format([deb]; "yyyy/mm")

It's different.
 

ryprobg

Member
Local time
Today, 06:35
Joined
Sep 3, 2022
Messages
59
That's not what you wrote in your original post.

You wrote: expr1: Format([deb];"""yyyy""/mm")

I wrote: expr1: Format([deb]; "yyyy/mm")

It's different.
yes is the same when i entre expr1: Format([deb]; "yyyy/mm") the system gives expr1: Format([deb];"""yyyy""/mm") on the query createria
 

LarryE

Active member
Local time
Yesterday, 22:35
Joined
Aug 18, 2021
Messages
605
Instead of using a ; (semi-colon) as a separator in the Format Function, try using a , (comma) so:
Format([deb],"yyyy/mm")
or try:
Year([deb] & "/" & Month([deb])
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:35
Joined
Sep 21, 2011
Messages
14,447
You and Dates do not get on do you? :)

Code:
SELECT TestTransactions.TransactionDate, Format([TransactionDate],"yyyy/mm") AS Expr1
FROM TestTransactions;
1662918451238.png

So what do you have in Deb? Is it even a Date (in numerical form?)
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:35
Joined
Sep 21, 2011
Messages
14,447
Instead of using a ; (semi-colon) as a separator in the Format Function, try using a , (comma) so:
Format([deb],"yyyy/mm")
or try:
Year([deb] & "/" & Month([deb])
I tried that, but it removes the leading zero for Month?
 

ryprobg

Member
Local time
Today, 06:35
Joined
Sep 3, 2022
Messages
59
Instead of using a ; (semi-colon) as a separator in the Format Function, try using a , (comma) so:
Format([deb],"yyyy/mm")
or try:
Year([deb] & "/" & Month([deb])
no in frensh windows ; replace ,
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:35
Joined
Sep 21, 2011
Messages
14,447
expr1: Format(CDate([deb]); 'yyyy/mm') even? :)
I mention it as OP would copy that as is :(
 

cheekybuddha

AWF VIP
Local time
Today, 06:35
Joined
Jul 21, 2014
Messages
2,321
Answering on my phone! Blinking auto-corrupt! 😖😂

Already fixed

Cheers 👍
 

ryprobg

Member
Local time
Today, 06:35
Joined
Sep 3, 2022
Messages
59
resolved!
 

Attachments

  • 001.jpg
    001.jpg
    463.3 KB · Views: 99
  • 0002.jpg
    0002.jpg
    435.7 KB · Views: 100

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:35
Joined
Feb 19, 2002
Messages
43,484
So, what happened when you googled Format() function? Did you get the French values or the English values for the command? Clearly this won't be your only problem with Access functions.
 

cheekybuddha

AWF VIP
Local time
Today, 06:35
Joined
Jul 21, 2014
Messages
2,321
Do you have to use jj instead of dd as well,

eg Format([deb],"aaaa/mm/jj")

?
 

sonic8

AWF VIP
Local time
Today, 07:35
Joined
Oct 27, 2015
Messages
999
@ryprobg, when asking questions about queries here at AWF, it is probably sensible to use the SQL of your queries as a reference. SQL View in Access will display the original English language representation of the query instead of the localized French translation from the Design View.

Additional Bonus: The SQL of the query can be pasted here as text and is a more precise and concise description of the query than a screenshot of the Design View.
 

Users who are viewing this thread

Top Bottom