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

  • Home
  • SEARCH
  • 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 6124727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:09:56+00:00 2026-05-23T16:09:56+00:00

I am having issues serializing correct JSON for date fields in gwt. In gwt,

  • 0

I am having issues serializing correct JSON for date fields in gwt.

In gwt, I have an overlay class with a JsDate field called ‘dtTemp’. Outside of the object, I set the value like this: myOverlayObj.setDtTemp(JsDate.create(1999, 10, 1));

I have a “toJSON” method in the overlay class which converts the object to JSON which can be passed back to my ASP.NET web service. It looks like this:

public final String toJSON(){
return new JSONObject(this).toString();
}

Unfortunately, it seems that the JSON being generated has bad dates. It creates this JSON for an object where dtTemp is SUPPOSED TO BE 10/1/1999:
{“intTemp”:7007, “strTemp”:”hello”, “dtTemp”:941439600000}

when it should create this (I created this parallel object in .NET using a JSON serializer):
{“intTemp”:7007, “strTemp”:”hello”, “dtTemp”:new Date(938761200000)}

my question is, how can I serialize valid dates in gwt? Not only is it missing ‘new Date’ but it’s a totally different number! (when evaluate the Datetime
in .NET using JSON.NET the date that ‘toJSON’ generated ends up to be something like 11/1/1999 at 7AM)

Any help would be appreciated!

Thanks!

  • 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-23T16:09:57+00:00Added an answer on May 23, 2026 at 4:09 pm

    JSON cannot represent dates: http://www.json.org

    new Date is JavaScript, it’s not JSON.

    As for the difference in the unix timestamp, there are two issues:

    1. first, JsDate.create(1999, 10, 1) really represents 11/1/1999, and not 10/1/1999: months in the API are 0-based, so 10 is November.
    2. The “7AM” is due to the timezone: 938761200000 is 10/1/1999 7AM UTC, and 941439600000 is 11/1/1999 7AM UTC. You’re probably at UTC+7, so your 10/1/1999 00:00 UTC+7 really is 10/1/1999 07:00 UTC: when you create a date using Jsdate.create, it’s relatie to your timezone (so it’s 00:00 UTC+7 in your case), and your server then shows the date in UTC (which gives 7AM). You should use JsDate.UTC(1999, 9, 1, 0, 0, 0, 0) to create your instance.

    I highly recommend reading: http://unix4lyfe.org/time/

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

Sidebar

Related Questions

Im having issues getting this to work, maybe its not even possible? I have
Im having issues vertically positioning text inside of a text input field in Firefox.
I'm having issues getting Firefox to update a webpage when its class is changed
I'm having issues with a custom signal in a class I made. Relevant code:
I having issues getting Django to work with settings.py at different location I have
I am having an issue serializing a c# class to an XML file that
im having issues with the following interface and a class: public interface IRelated {
I am having issues testing which icon my notifyIcon is using. I have a
I am having issues with including really large files and so have used ini_set('memory_limit',
Having issues getting django custom commands to work. From django documetation , have placed

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.