Solved

jQuery UI datepicker unix timestamp giving extra zeros

Posted on 2014-04-18
2
970 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 250 total points
ID: 40010715
JS getTime is in milliseconds. Unix timestamp is in seconds
0
 
LVL 24

Assisted Solution

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

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

or
dateFormat: '@'
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now