asp.net mvc - MVC C# - user creates dates from specific time zone -
in program have create screen user enter new start , end date/time. user has profile specifies time zone want work in. don't want relative local time zone.
what want take start , end date/time user enters , convert utc based on user profile settings time zone. if user's profile set eastern standard time , specific start date 1/8/16 12:00, want convert est utc. don't want date "1/8/16 12:00" system's date or local time. can't seem figure out how define "1/8/16 12:00" est when conversion occurs utc user's input.
does make sense? let me know if need more info/examples.
you can save dates in database/nosql database/file /etc using utc format, either 2 between several ways it:
console.writeline(date1.touniversaltime()); console.writeline(timezoneinfo.converttimetoutc(date1))
do query in server , send date in utc format can render client in specific timezone formatting using javascript, there several libraries can 1 @ top of head moment.js little bit of overkill may helpful in other scenarios need modify dates.
take small example reference, going display "2 days ago", looks more human , more readable.
anyway that's idea.
Comments
Post a Comment