Fetch local time rather then server's Time

Discussion in 'ASP.NET / ASP.NET Core' started by jesha, Apr 2, 2010.

  1. Hi everyone,

    I need a help for Time Zone setting.

    We have 1 web page in our application where we show our client a date and time of "status" entered by their employees.

    Now, each time employee entered status It passes values of server's time and stores in database rather then passing Local time.

    So, I want to do some coding that will fetch employee's local time and then stores in Database.

    Pl pay attention that I have already tried with this code,
    txtenteredtime.text = System.TimeZone.CurrentTimeZone.ToLocalTime(Date.Now).Hour & ":" & System.TimeZone.CurrentTimeZone.ToLocalTime(Date.Now).Minute & ":" & System.TimeZone.CurrentTimeZone.ToLocalTime(Date.Now).Second
     
  2. Try DateTimeOffset

    Look into DateTimeOffset, which is supported by Framework 3.5, and designed for your problem I think.
     

Share This Page