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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:18:33+00:00 2026-05-24T09:18:33+00:00

I am trying to convert a DateObject into readable format (dd.MM.yyyy) with DateJS. I

  • 0

I am trying to convert a DateObject into readable format (dd.MM.yyyy) with DateJS.
I get an error:”llegal radix 0″ when trying to convert it into a string.

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pick the date</title>
<link type="text/css" href="css/smoothness/jquery-ui-1.8.14.custom.css" rel="Stylesheet" /> 
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<script src="inc/date-fi-FI.js" type="text/javascript"></script>
<script type="text/javascript">
    function parseDate() {
        var date = $('#date').val();
        var parsedDate = Date.parse(date);
        alert('Parsed date: '+parsedDate);
    }
    function jämförMedIdag (datum) {
        if (datum == null || datum == "") {
            alert('Inget datum!');
            return;
        }
        /*resultat = Date.compare(Datum1,Datum2);
        alert(resultat); */
        var datum = Date.parse(datum);
        var dagar = datum.getDate();
        var månader = datum.getMonth();
        var år = datum.getYear();
        var nyttDatum = new Date();
        nyttDatum.setFullYear(år,månader,dagar);
        var idag = new Date();

        if(nyttDatum>idag) {
            var svar = nyttDatum - idag;
            svar = svar.toString("dd.MM.yyyy");
            alert(svar);
            return(svar);
        } else {
            var svar = idag - nyttDatum;
            svar = svar.toString("dd.MM.yyyy");
            alert(svar);
            return(svar);
        }
    }
</script>
</head>

<body>
<form>
    <input type="text" name="date" id="date" value ="13.03.1990" />
    <input type="button" onclick="jämförMedIdag(document.getElementById('date').value)" value="Compare the date" />
</form>
</body>
</html>

See it in action: http://resk.latvalashop.com/date.php

  • 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-24T09:18:34+00:00Added an answer on May 24, 2026 at 9:18 am

    Subtracting Dates does not return a new Date, but a number. To convert it to a Date, try this:

    new Date(endDate - startDate).toString("dd.MM.yyyy");
    

    However, if you are trying to see the difference (like 1 month), this won’t help, because it will start at 1 January 1970.

    To be precise, the number you get is the amount of milliseconds since 1 January 1970. So the difference expressed as a number is the difference in seconds. A week is 7 * 24 * 60 * 60 * 1000 milliseconds, so use something along the lines of:

    if(endDate - startDate > 7 * 24 * 60 * 60 * 1000) {
        alert("Difference is more than a week");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to convert a string in the format dd-mm-yyyy into a date
Trying to convert this c code into MIPS and run it in SPIM. int
Trying to convert a JSON string into an object in C#. Using a really
I am trying to convert a string which is of the format August 1,
I'm trying to convert a string of numbers, entered by the user, into a
Trying to convert a date format into a MySQL date: SELECT STR_TO_DATE('8/3/2011 13:30','%m/%d/%Y %h:%i');
I'm trying to convert old QuickTime framework code to the 64-bit Cocoa-based QTKit on
I'm trying to convert some code that worked great in VB, but I can't
I am trying to convert an ASP.NET website into a web application project. The
I am trying to convert an int into three bytes representing that int (big

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.