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