DateTime Offset

Hi There! I am pretty new to Linqpad. I am using it to query a SQL server which has information stored within multiple tables. One of the column is for DateTime.

I am in IST timezone however the data retrieved is in UTC timezone. If i need the data to be converted to IST timezone, can i use DateTimeOffset option in Linqpad under Preferences\Results to add or subtract a time.

If yes, how does it work? If you can point me to any related docs will be really helpful.

Any help is highly appreciated!

Comments

  • Have you tried calling .ToLocalTime() on the date column?
    from p in Purchases
    select new { UtcDate = p.Date, LocalDate = p.Date.ToLocalTime() }
  • Yes, i have tried using ToLocalTime() instead of ToUniversalTime(), it doesnt make a difference in this case
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!