Results 1 to 9 of 9

Thread: Jason's Date Input Calendar Help Required

  1. #1
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Jason's Date Input Calendar Help Required

    Hi,

    I am attempting to implement Jason's Date Input Calendar into my website for searching availability. However, although on the front end the calendar is displayed as three input/select boxes, it actually sends the date variable as date=26-01-2014 instead of day=26&month=01&year-2014.

    Is there anyway of modifying the code to get this to work this way?

    Many thanks

    Chris

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Please post about Dynamic Drive Scripts in the Dynamic Drive Scripts Help section here where I've moved this thread, and:

    Warning: Please include a link to the DD script(s) in question in your post. See this post for more information.


    That said, if the back end is PHP, it would probably be easier to just parse the given value. BTW it's not 26-01-2014, it's 26-JAN-2014.

    For instance, you can get a UNIX timestamp in PHP like so:

    PHP Code:
    strtotime('26-JAN-2014'
    Last edited by jscheuer1; 01-29-2014 at 03:07 PM. Reason: add PHP code
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you, however, I don't think that would help create three different variables.

    Yes you are right it is currently sent as 26-JAN-2014 but I need three different values sent seperately which I thought this calendar did as its three inputs.
    Last edited by jscheuer1; 01-29-2014 at 03:28 PM. Reason: excess quoting

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    You could explode the string into separate variables like this;

    PHP Code:
    <?php

    $string 
    '26-JAN-2014';

    list(
    $day$month$year) = explode('-'$string);

    echo 
    $day;
    echo 
    "<br/>";
    echo 
    $month;
    echo 
    "<br/>";
    echo 
    $year;

    ?>
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes, or if you want all numbers:

    PHP Code:
    $string =  date('d m Y'strtotime('26-JAN-2014'));

    list(
    $day$month$year) = explode(' '$string);

    echo 
    $day;
    echo 
    "<br/>";
    echo 
    $month;
    echo 
    "<br/>";
    echo 
    $year
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, many thanks for this. How do I go about incorporating this code into the code provided by the date input calendar?

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Are you using PHP?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Jan 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes I am, many thanks.

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well you would just plug that in to your PHP back end to separate out the values for you that way. If you need help doing that we would need to see your page and the PHP back end but it would be something like:

    PHP Code:
    $orderdate = isset($_GET['orderdate'])? $_GET['orderdate'] : false;
    if(!
    $orderdate){die();}
    $string date('d m Y'strtotime($orderdate));

    list(
    $day$month$year) = explode(' '$string); 
    After that, you would just use the separate $day, $month, $year values.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Jason's Date Input Calendar - Need Help to Display Empty Date Fields?
    By Dorgs in forum Dynamic Drive scripts help
    Replies: 9
    Last Post: 06-07-2013, 02:08 PM
  2. passing & recieving a date with mysql using Jason's Date Input Calendar
    By kkslider in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 02-19-2012, 04:30 PM
  3. Jason's Date Input Calendar - Calendar reappearing in IE8
    By NGJ in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 03-30-2011, 01:30 PM
  4. Jason's Date Input Calendar onClick to change the showing date
    By williamstam in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 03-13-2008, 12:48 PM
  5. Replies: 1
    Last Post: 11-04-2005, 05:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •