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 8700811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:15:15+00:00 2026-06-13T02:15:15+00:00

All, We are using ASP.NET Web API where we have a REST based service

  • 0

All,

We are using ASP.NET Web API where we have a REST based service with JSON for the payload. If I pass the following Date as a string e.g

sampleObj: {
...
myDate: "31/12/2011 00:00:00",
...
}

as an attribute value in the JSON payload, the date attribute gets deserialised into a DateTime.MinValue. Is the string format valid?

We know the format “2012-10-17 07:45:00” serialises successfully but we cannot guarantee that all dates received will be in this format. What are the valid options?

  • 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-06-13T02:15:17+00:00Added an answer on June 13, 2026 at 2:15 am

    In ASP.NET Web API, you can add different Json.NET DateTimeConverters through the JsonFormatter’s SerializerSettings to make your service understand different DateTime format.

    However, I do not think there is a default DateTimeConverter from Json.NET that takes in this format “31/12/2011 00:00:00”. In this case you implement your custom DateTimeConverter.

    WebApiConfig.cs:

            config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(
                 new IsoDateTimeConverter());
            config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(
                 new MyDateTimeConverter());
    

    Custom DateTimeConverter:

    public class MyDateTimeConverter : DateTimeConverterBase
    {
        //...
    }  
    

    For more information about how to write a custom DateTimeConverter, I found something on stackoverflow that you might find useful:
    How to create a json.net Date to String custom Converter.

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

Sidebar

Related Questions

All, I have a ASP.NET Web API project that is making a REST call
I'm creating an api using Asp.net web api. I have controller BookController with two
I have an ASP.NET MVC 4 Web API app using EntityFramework for ORM. In
Using asp.net 3.5 Gridview control, visual studio 2008. I have played with all the
I have a lot of data-entryists using my ASP.NET application and we have all
Here's what i have : ASP.NET 4.0 Web Application Forms Authentication (Cookie Based) Here's
I'm using WCF Web API to create a self-hosted/InProcess REST Service (HttpServiceHost) that the
For this question, I'm using ASP.NET Web Forms in C#, a web service and
I'm using ASP.NET Web API with Entity Framework. I changed my default serializer to
I am using ASP.NET MVC 4 Beta with Web API - although I believe

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.