C# DateTime Convert from string to DateTime in differents TimeZones -


i'm struggling problem. have string date looks this, "2015-05-02 01:00:00", extracted database.

i know it's british time, local time belgian time. i'm trying store date in utc , in (cest or cet depend of season), converting british time i've extract.

i tried set kind property british time, result seems in local or utc time. so, can half of job, not rest (e.g. still need cest/cet time).

i tried use :

string datestring = (string) line["stringdate"];  datetime uktime = datetime.parse(datestring, new cultureinfo("en-gb", false)); datetime belgiantime = timezoneinfo.converttimebysystemtimezoneid(uktime, "romance standard time"); 

the result same both uktime , belgiantime: 2015-05-02 01:00:00 kind = unspecified.

it should 2015-05-02 02:00:00 belgiantime

if add source time zone conversion method gives desired answer, without specifying iformatprovider.

string datestring = (string) line["stringdate"];  datetime uktime = datetime.parse(datestring); datetime belgiantime = timezoneinfo.converttimebysystemtimezoneid(uktime,     "gmt standard time",     "romance standard time"); 

this gives time kind == unspecified. if use:

var belgiantime = timezoneinfo.converttime(uktime,     timezoneinfo.findsystemtimezonebyid("gmt standard time"),      timezoneinfo.local); 

for conversion, kind == local


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -