Results 1 to 2 of 2

Thread: Always format date to EST regardless of locale

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    2,012

    Always format date to EST regardless of locale

    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?

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,958

    Re: Always format date to EST regardless of locale

    Quote Originally Posted by nbrege View Post
    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
  •  



Click Here to Expand Forum to Full Width