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

  • Home
  • SEARCH
  • 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 8113611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:53:01+00:00 2026-06-06T02:53:01+00:00

i’ve got a date-range picker, with 2 field each date picker: dat_start and date_end;

  • 0

i’ve got a date-range picker, with 2 field each date picker: dat_start and date_end;
everything’s fine except the Timestamp of the field I will pass to server to do the search; I know JS Timestamp is in ms, but I should have it /1000…and I can’t find the way to do. Here’s my code:

<script>
$(function () {
    $("#data_inizio").datepicker({
        altField: '#mod_available_date_id_start',
        altFormat: '@',
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 1,
        onSelect: function (selectedDate) {
            $("#data_fine").datepicker("option", "minDate", selectedDate);
        }
    });
    $("#data_fine").datepicker({
        altField: '#mod_available_date_id_finish',
        altFormat: '@',
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 1,
        onSelect: function (selectedDate) {
            $("#data_inizio").datepicker("option", "maxDate", selectedDate);
        }
    });
});
</script>

Thanks to everyone, and sorry for my bad english!

  • 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-06-06T02:53:03+00:00Added an answer on June 6, 2026 at 2:53 am

    Get the string/date selected by the picker and cast it to a date:

    var stringyDate = $("#data_inizio").val(); // mm/dd/yyyy
    var dateyDate = new Date(stringyDate);
    

    Now get the valueOf() (which returns milliseconds since January 1, 1970) and divide by 1000 to get the number of seconds since [same].

    var ms = dateyDate.valueOf();
    var s = ms / 1000;
    

    Example fiddle: http://jsfiddle.net/QpQ7U/

    To have this happen on date selection, modify the onSelect callback function in the datepicker options.

    onSelect: function(selectedDate) {
        var v = $(this).val(),
            d = new Date(v);
        if (v.length > 0) {
            $('p#out').text(d.valueOf() + ' divided by 1000 is ' + (d.valueOf() / 1000));
        } else {
            $('p#out').text('No date selected');
        }
    }
    

    Example fiddle with onSelect: http://jsfiddle.net/QpQ7U/1/

    To store the value in a hidden field, simply specify the field in the onSelect:

    onSelect: function(selectedDate) {
        var d = new Date(selectedDate),
            s = parseSeconds(selectedDate);
        if (s > 0) {
            //display to user
            $('p#out_inizio').text(d.valueOf() + ' divided by 1000 is ' + s);
            //store in hidden field.
            $('input#out_inizio').val(s);
        } else {
            $('p#out_inizio').text('No date selected');
        }
        //set min date on other picker
        $("#data_fine").datepicker("option", "minDate", selectedDate);
    }
    

    Example fiddle with hidden fields: http://jsfiddle.net/QpQ7U/2/

    To format as day/month/year, use the dateFormat option:

    $("#data_inizio").datepicker({
        altField: '#mod_available_date_id_start',
        altFormat: '@',
        dateFormat: 'dd/mm/yy',
        ...
    });
    

    Example fiddle: http://jsfiddle.net/QpQ7U/5/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I need a function that will clean a strings' special characters. I do NOT
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.