Hello
I have a grid that displays dates like this:
The above dates (July dates) are en-AU format and are controlled by setting the culture in program.cs. The grid column itself has Format="d".
So
- when the culture is en-AU then I get (say) 9/7/2021 (i.e 9th July)
- when the culture is en-US then I get 7/9/2021 (i.e 9th July)
What I am trying to do is force all my dates to have leading zeros....so what I am looking for is:
- when the culture is en-AU then I would get 09/07/2021
- when the culture is en-US then I would get 07/09/2021
I can format the date directly in the column, i.e "dd/MM/yyyy" but then this does not play nicely with the culture setting.
Any ideas
Thank you
Hey
Thanks for the information. My question was simply if there is a way to ensure dates for all cultures have leading zeros without specifying it directly in the format of the grid column.
So if the culture was en-US then you would see "02/09/2022" , not "2/9/2022" (February 9th)
if the culture was en-GB then you would see "09/02/2022", not "9/2/2022"
(February 9th)
If you specify Format="d" then it handles the culture change, but without the leading zero.
I think the answer is no, so I have simply set the dateformat when setting the culture and then specifiy the Format like this:
Format="@MyAppStateService.MyCultureDateFormat"
Thanks for your help