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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:17:56+00:00 2026-06-06T19:17:56+00:00

Is there an easy way to compare a sql dateTime to a javascript date

  • 0

Is there an easy way to compare a sql dateTime to a javascript date time so that the two can be compared easily?

Are there built in javascript functions as I cant edit the sql

  • 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-06T19:17:57+00:00Added an answer on June 6, 2026 at 7:17 pm

    To convert a MySQL DATETIME String into a JavaScript Date object:

            var sqlDateStr = "2012-01-02 23:58:59"; // as for MySQL DATETIME
            sqlDateStr = sqlDateStr.replace(/:| /g,"-");
            var YMDhms = sqlDateStr.split("-");
            var sqlDate = new Date();
            sqlDate.setFullYear(parseInt(YMDhms[0]), parseInt(YMDhms[1])-1,
                                                     parseInt(YMDhms[2]));
            sqlDate.setHours(parseInt(YMDhms[3]), parseInt(YMDhms[4]), 
                                                  parseInt(YMDhms[5]), 0/*msValue*/);
            alert(sqlDate);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an easy way to check in a unit test that two arrays
With SubSonic 3 / ActiveRecord, is there an easy way to compare two records
Is there an easy/generic way to compare two objects to see if they are
Is there an easy way to compare the file tree of an old git
Is there an easy way to convert an RFC 3339 time into a regular
Hey, is there any easy way to get information when user will change time
I wonder if there is an easy way to check if two strings match
Is there an easy way to setup Notepad++'s Compare plugin as the diff tool
I am wondering if there is an easy way to compare a couple of
I am creating a generic operator method that can dynamically compare two objects of

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.