Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

jQuery UI datepicker unix timestamp giving extra zeros

Posted on 2014-04-18
2
Medium Priority
?
1,166 Views
Last Modified: 2014-05-02
Hi,

I'm just wondering why jQuery's UI datepicker returns extra zeros (3 to be exact) at the end of their unix timestamp:

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>jQuery UI Datepicker - Dates in other months</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script>
        $(function() {
            $( "#datepicker" ).datepicker({
                showOtherMonths: true,
                selectOtherMonths: false,
                altField: "#alternate",
                altFormat: "@"
            });
        });
    </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>
<p>Date: <input type="text" id="alternate"></p>


</body>
</html>

Open in new window


http://api.jqueryui.com/datepicker/#utility-formatDate

Is there something I'm missing?

thank you and God bless<><
Victor
0
Comment
Question by:Victor Kimura
2 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 1000 total points
ID: 40010715
JS getTime is in milliseconds. Unix timestamp is in seconds
0
 
LVL 27

Assisted Solution

by:lenamtl
lenamtl earned 1000 total points
ID: 40018024
Try dateFormat instead of altFormat

replace
altFormat: "@"
by
dateFormat: "@"

or
dateFormat: '@'
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question