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
Post a Comment