c# - Given an unzoned DateTime and a timezone, how can I construct an instant in NodaTime? -


i have datetime constructed explicitly.

var mydatetime = new datetime(2015,1,1,0,0,0); 

i have timezone obtained explicitly.

var mytimezone = datetimezoneproviders.tzdb["america/los_angeles"]; 

mydate known represented in mytimezone

how should use information generate zoneddatetime or instant using nodatime?

first, convert datetime localdatetime.

localdatetime ldt = localdatetime.fromdatetime(mydatetime); 

then can assign zone:

zoneddatetime zdt = ldt.inzoneleniently(mytimezone); 

and map instant:

instant instant = zdt.toinstant(); 

Comments

Popular posts from this blog

delphi xe7 upload/download dropbox file using the rest client and show progress -

java - Get more than One value and display it -

apache - PHP Soap issue while content length is larger -