|
-
Oct 24th, 2024, 09:37 AM
#2
Re: Always format date to EST regardless of locale
 Originally Posted by nbrege
I have a program that is used by people from all over the world. It writes a date/time stamp to an online database. After looking at the time stamps, I see they are different formats, based on the users location. How can I format the datetime string to always be US EST, regardless of the locale?
Ideally don't store dates as strings in the database, store them as dates (assuming your database has a date / datetime data type), if you must store them as strings you are probably better storing them in a standard, non-region specific, format e.g. https://blog.ansi.org/2019/01/iso-da...ells-standard/
If you must store it in EST then you can always use .ToString() on the date to get it into a string - https://learn.microsoft.com/en-us/do...format-strings should get you started on how to format the resulting string.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|