ASP.NET DateTime object "changes" when passed to Javascript -


i have asp.net webservice whicn runs on local computer in test environment. local computers utc time +1 (denmark). have these methods available javascript client:

[webmethod(enablesession=true)] public datetime getdatetime() {   return new datetime(2013,3,15,10,0,0); }  [webmethod(enablesession=true)] public void setdatetime(datetime dt) {  } 

when call first method javascript , alerts passed datetime, correctly shows 10 time: 'fri mar 15 2013 10:00:00 gmt+0100 (romance standard time)' after alert, pass datetime object webserver. when debug object, datetime 9 am. how come? client , server runs on same machine. i´ve played around datetime.specifykind, overall result same; client subtracts hour when time sent server.

hope can me better understanding of subject.

thank in advance.

@millimoose i´ve tried datetimeoffset solution, didnt help. not sure if used 100% correctly though. works me this:

before send datetime(s) server client, dont datetime (such setting utc). javascript client shows correct time. when javascript sends time server, hour added. call .tolocaltime(); on datetime object, , time correct.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -