Click here to Skip to main content
15,943,419 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
my date value is
Wed Sep 07 2022 00:00:00 GMT+0430 (Iran Daylight Time) 

when convert it to json

Output is

I need this format 'yyyy/mm/dd'
day in mydate is 7
in json is 6
Please help me

What I have tried:


Richard Deeming 7-Sep-22 7:55am    
The output is correct; your computer is almost certainly set to a timezone of at least UTC+04:30, meaning that midnight on 7th in your timezone is equivalent to 19:30 on 6th in UTC.
Richard Deeming 7-Sep-22 7:57am    
And since JSON doesn't have a "date literal" option, the convention is to serialize to a string using the ISO8601 format. If you change the format, then the code you're passing your JSON to will have to be updated to use the non-standard format as well.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900