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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:20:30+00:00 2026-05-26T03:20:30+00:00

I am using Newtonsoft’s Json when i serialze a date time property i get

  • 0

I am using Newtonsoft’s Json
when i serialze a date time property i get the json response as:

..."CreatedOn":"\/Date(1317303882420+0500)\/",...

i want it to be in simple string as

..."createdOn": "2011-05-05 14:03:07", ...

while my class property is DateTime, how can i force to serialze it as string, as we can add attribute to change the property name as

  [JsonProperty("id")]
        public int ProductID { get; set; }

is there a similar way to force a DateTime property to serialize to string??

  • 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-26T03:20:30+00:00Added an answer on May 26, 2026 at 3:20 am

    From a post made by James Newton-King on StackOverflow, it looks like you can do this.

    string isoJson = JsonConvert.SerializeObject(this, new IsoDateTimeConverter());
    // {"Details":"Application started.","LogDate":"2009-02-15T00:00:00Z"}    
    

    Referenced answer:
    Parsing JSON DateTime from Newtonsoft's JSON Serializer

    Also here is the documentation on Json.NET and dates:
    Serializing Dates in JSON

    Here is an example of using the DateTimeFormat property to customize the output:

    return JsonConvert.SerializeObject(this, Formatting.None, new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the following json (see below) deserialized (using newtonsoft json serializer)
I've serialized an object using Newtonsoft's JSON serializer, and the DateTime has come through
Currently I am using the terrific Linq 2 Json.net (by newtonsoft), which is a
Please see: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Converters;
I have a working application using Json.NET (newtonsoft) as a custom serializer. Currently I'm
I'm attempting to serialize a class hierarchy in Newtonsoft Json using C#. My class
I'm using Newtonsoft.Json to turn json into objects, that works fine. I was wondering
Trying to compile a project using the Newtonsoft.Json.WindowsPhone reference and I am gettign 2
I am using Newtonsoft.Json to Deserialize json string to Object, but I can't judge
I am using Newtonsoft Json library to parse json but i don't know how

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.