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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:38:16+00:00 2026-06-08T11:38:16+00:00

I have a date formatted like this from a Java Server: YYYY/MM/DD 00:00:00.0 And

  • 0

I have a date formatted like this from a Java Server:

YYYY/MM/DD 00:00:00.0

And that is a format that JavaScript won’t accept. So, I do this:

var startDate = '2012-07-27 00:00:00.0';
startDate = startDate.substring(0, 10);

Which then kindly returns 2012-07-27. (Note: I tried it with the time and without)

However, then I want to turn it into a date format I can use to compare two dates. So, I preform this:

startDate = new Date(startDate);

Which, finally, returns this in the log: Invalid Date

So, for the purpose of comparing dates, like so:

if(currentDate > startDate)

I need to be able to get the format I have into one that will be accepted so I can then compare each of the various dates.

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-08T11:38:17+00:00Added an answer on June 8, 2026 at 11:38 am

    You string format is incompatible that is why new Date(datestring) won’t work. You can parse the string yourself with Regex and create a new Date object with explicit values for year, month, date, minute and second . Look at Date.parse for valid format

    Or use this https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC after parsing your string
    example for your string would be

    gmtDate = new Date(Date.UTC(2012, 07, 27, 0, 0, 0));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a date that I get from a server formatted in EST like
I have an object that is formatted like this: var telemetry_data = { T36:
I have a date in String format, mm/dd/yyyy I want to convert this to
I have a date field in a mysql table formatted like this: Y-m-d. I
I have a date formatted like this: 2011-15 The first piece is a 4
I have methods in all of my models that look like this: def formatted_start_date
I have date formatted in this way: 2010-02-04T00:00:00 I use this code to parse
I have this code snippet: DateFormat formatter1; formatter1 = new SimpleDateFormat(mm/DD/yyyy); System.out.println((Date)formatter1.parse(08/16/2011)); When I
I have date in sting object in following format. dd/mm/yyyy I want to change
I have a date in this formate YYYY/MM/DD. Now I want to get the

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.