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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:16:58+00:00 2026-05-22T16:16:58+00:00

A unix timestamp should only be ten characters, however I keep getting 13 characters

  • 0

A unix timestamp should only be ten characters, however I keep getting 13 characters and it’s causing me issues. How can I fix this?

<script type="text/javascript">
$(document).ready(function()
{
    $("#startdate").datepicker({ altField: "#startdatehidden", altFormat:$.datepicker.TIMESTAMP, dateFormat:$.datepicker.TIMESTAMP, mandatory: true });
});
</script>
  • 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-22T16:16:59+00:00Added an answer on May 22, 2026 at 4:16 pm

    though I would recommend you validate date on server and make changes there if possible, for instance a user might not have javascript and would manually put a date there that you should anyway try to turn into date (in php with strtotime) and you could use the same block to convert js timestamp to unix timestamp! There is alot you have to do to make this bullet proof on the client-side as I will explain one scenario but to answer your question and go about it your way this is a way to start:

    You will need create a separate input field to display the jQuery UI Datepicker lets call it

    <input id='display_startdate' type='text' name='does-not-matter-server-will-not-use-this'>
    

    and then your old <input type='hidden' name='startdate' id='startdate'> which will be used for your server-side code, but you will not apply the jQuery datepicker on this field. You can put it as type text for testing then change it to hidden since user doesn’t need to see this!

     $(function(){
             $( "#display_startdate" ).datepicker({ 
                  altFormat: '@' , 
                  altField: '#Inspection_End',
                  //now the lines below will divide the ms by 1000 to give you POSIX TIMESTAMP
                  onSelect: function() { 
                       fixTime(); 
                  }
             });
        });
        //There are other times you need to evaluate the value of this field
        //as an example some browsers will keep the input user entered on page refresh
        //but will not keep the value javascript created
        $('#yourForm').submit(function(){
        //or $('#yourSubmit').click(function(){
                fixTime();   
                //do rest!
        });
        function fixTime(){
             $('#startdate').val($('#startdate').val()/1000);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming I have a unix timestamp in PHP. How can I round my php
How can I convert from a unix timestamp (say 1232559922) to a fractional julian
I need to convert a unix timestamp to a date object. I tried this:
I store all datetime values as unix timestamp. Registered users can set personal GMT
This is seriously killing me. I'm trying to convert a Unix timestamp (1236268800, which
How can I convert UNIX timestamp (bigint) to DateTime in SQL Server?
Possible Duplicate: Convert a Unix timestamp to time in Javascript I am getting date
I can convert a unix timestamp to a Date() object by putting the long
I have a Unix timestamp that I need to get the individual year, month,
I have a unix timestamp that I would like to convert using mysql if

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.