c# - Trouble converting UTC time received from database to local time -


i have been attempting convert string representing time in utc local non-utc format.

for example, 1 of strings attempting convert:

2017-04-07t16:00:00.000z 

and trying datetime (m/d/yyyy, etc.) format of:

4/7/2017 4:00 pm 

but reason output receiving in european datetime (d/m/yyyy, etc.) format of:

7/4/2017 4:00 pm 

my code attempting convert string follows:

datetimeoffset start_time = datetimeoffset.parse(event_time);  // in unity, debugging time without offset  debug.log(start_time.localdatetime); 

i have attempted use parseexact , other methods output in desired format, haven't been having luck far. doing wrong?

you can pass format in tostring method m/d/yyyy, see more custom date , time format strings

debug.log(start_time.localdatetime.tostring("m/d/yyyy h:mm tt")); 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -