impossible to get year in format date

ryprobg

Member
Local time
Today, 19:39
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
 
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: 125
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.
 
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
 
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])
 
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?)
 
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?
 
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 ,
 
expr1: Format(CDate([deb]); 'yyyy/mm') even? :)
I mention it as OP would copy that as is :(
 
resolved!
 

Attachments

  • 001.jpg
    001.jpg
    463.3 KB · Views: 144
  • 0002.jpg
    0002.jpg
    435.7 KB · Views: 148
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.
 
Do you have to use jj instead of dd as well,

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

?
 
@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

Back
Top Bottom