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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:53:02+00:00 2026-06-13T13:53:02+00:00

I have a mysql table with dates in it (format: yyy-mm-dd). I then retrieve

  • 0

I have a mysql table with dates in it (format: yyy-mm-dd). I then retrieve the dates and save them, however in the procures I change the dates format to make the user viewing easier for the task at hand. My issue is that when I get dates that are too far in the future (out a few months) they change and fall a day behind (otherwise it works fine). I spent a lot of time reading up on how the javascript date conversion works but I still do not have a firm understanding. Without what i wrote the date always comes in after the conversion a day behind. Also I am located in ohio. Here is what I have:

    var x = offset*60000;  
    var time = new Date (item.start);
    var time2=time.getTime();
    var time3=time2+x;
    var start = $.datepicker.formatDate('D, d M, yy', new Date (time3));

what is the issue here? Also if you could give a quick explanation for my education, that would be great. 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-06-13T13:53:03+00:00Added an answer on June 13, 2026 at 1:53 pm

    The problem is that the format you are passing to the Date constructor does not seem valid according to – https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date (i.e. a version of the ISO8601 extended format) is a valid ES5 format but is not correctly parsed by the browser.

    So something like this should be what you need:

    http://jsfiddle.net/xfz6L/

    var date_string = "2012-11-02";
    
    var first_try = new Date(date_string);
    alert(first_try.toDateString());
    
    // The following is the code you would use
    var date_split = date_string.split("-");
    var second_try = new Date(date_split[0], +date_split[1]-1, date_split[2]);
    alert(second_try.toDateString());
    

    Since the problem seems to be that it is not a valid format not all browsers correctly parse the ISO8601 format, my solution is to use the string provided and manipulate it to work as a valid constructor.

    The easiest way I can think of is passing the “year”, “month”, and “day” in that order to the constructor.

    To do that, you need to split the string by - and then pass each array index to the constructor.

    The reason I subtract “1” from the month is that the range is from 0 to 11.

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

Sidebar

Related Questions

I have a Mysql table that stores dates in the format (YYYY-MM-DD HH:MM:SS). What
I am using mysql and have a table (Log_Table) storing user login dates, a
I have these mysql dates in a table of my database, 2010-07-16 20:09:06 2010-08-16
I have a mysql table that contains a date field in epoch time format.
I have a mysql table with a VARCHAR field that stores the dates in
I have a mysql table that has a column that stores dates but isn't
I have the dates stored in a mySQL table from 2010 - 2040 in
I'm wondering how to format this query. I have a table with three dates,
I have a dates in mySQL stored in format 2012-09-16 as DATE format and
i have a mysql table in the following format ------------------------------------------------------------------------------------------------------------- | event_id | event_type

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.