Solved

jQuery UI datepicker unix timestamp giving extra zeros

Posted on 2014-04-18
2
949 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
Comment Utility
JS getTime is in milliseconds. Unix timestamp is in seconds
0
 
LVL 24

Assisted Solution

by:lenamtl
lenamtl earned 250 total points
Comment Utility
Try dateFormat instead of altFormat

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

or
dateFormat: '@'
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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 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)

772 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

12 Experts available now in Live!

Get 1:1 Help Now