Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 643699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:18:40+00:00 2026-05-13T21:18:40+00:00

I have a date I’m reading from an API in the following format: 2010-03-15T00:00:00-04:00

  • 0

I have a date I’m reading from an API in the following format:

2010-03-15T00:00:00-04:00

When assigned to a date datatype in C#/VB.net, it’s displayed as:

3/14/2010 11:00:00 PM //Note 3/15 is being displayed as 3/14

why is this displayed as the previous day? Is there a name for the format above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:18:41+00:00Added an answer on May 13, 2026 at 9:18 pm

    Couple issues here:

    1) make sure to notice that the original string includes a timezone offset of -04:00, so it’s not in UTC format. The UTC version of the same point in time would obviously be 2010-03-15T04:00:00Z (ending Z means UTC / Zulu). When you then displayed the DateTime, it shows the local timezone version – since your local timezone is EST (-5), then it displays 1 hour before what appears in the original string (which was offset @ -4), hence the 11:00pm

    2) it sounds like your goal here isn’t to show the local timezone nor UTC versions of the timestamp, but instead keep it at the same offset as what the input string had specified. Luckily 3.5 added a type just for this kind of scenario: DateTimeOffset

    • http://blogs.msdn.com/bclteam/archive/2007/06/14/datetimeoffset-a-new-datetime-structure-in-net-3-5-justin-van-patten.aspx
    • http://msdn.microsoft.com/en-us/library/system.datetimeoffset_members.aspx

    if you were to use DateTimeOffset instead of DateTime, the default ToString output would then be:

    [342] C:\ » $dto = [datetimeoffset]::parse('2010-03-15T00:00:00-08:00')
    [343] C:\ » $dto.ToString()
    3/15/2010 12:00:00 AM -08:00
    [344] C:\ » $dto.DateTime.ToString()
    3/15/2010 12:00:00 AM
    

    Notice that it keeps both the same time and knowledge of the offset (hence the name of the type). If you don’t care about the offset and just want to get the DateTime for whatever offset the input was in, you can just fetch the DateTime property (as shown above). If you need to stick with a DateTime and can’t or don’t want to switch to DateTimeOffset, this may be the way to go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have date data being returned from a server in the following format through
I have date in following format (Y-m-d) as 2010-11-24, need to convert it to
I have date in sting object in following format. dd/mm/yyyy I want to change
I have date in this format 2011-11-02 . From this date, how can we
I have date in this format: 2010-01-11. I want to display JAN-11. How can
I have Following dummy table with data: ACID srno date(mm/dd/yyyy) name 3 1 04/12/2010
I have date of Birth of the format 04/08/2010(DD/MM/YYYY) and sql server store of
I have date formatted in this way: 2010-02-04T00:00:00 I use this code to parse
I have a Date format: 2009-08-10T16:03:03Z that I want to convert to: @MMM dd,
I have a date in YYYYMMDD format and a time in HHMMSS format as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.