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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:04:27+00:00 2026-05-25T19:04:27+00:00

I am writing a script that utilizes the datetimepicker widget, which is an extension

  • 0

I am writing a script that utilizes the datetimepicker widget, which is an extension of JQuery’s datepicker widget. The widget is applied dynamically to a generated list of events via this code:

$(function() {
    $( 'input[id^="event_"]' ).datetimepicker({
        stepMinute: 15  
    });
});

The date/time can be set via the following option:

// where x is the dynamic ID of the row
var dtpicker = $( '#event_x' );
dtpicker.datetimepicker('setDate', (new Date()) );

Here is how the rows are generated:

if($results != false){
    foreach($results as $event){
        echo "<tr>\n";
        echo "<td><input type=\"text\" id=\"" . $event['id'] . "\" value=\"" . $event['name'] . "\" /></td>\n";
        echo "<td><input type=\"text\" id=\"event_" . $event['id'] . "\" value=\"" . $event['date'] . "\" /></td>\n";
        echo "<td>Save stuff here?</td>\n";
        echo "</tr>\n";
    }
    unset($event);
}else{
    echo "<div>Error getting events</div>\n";
}

Basically I have to loop through the generated rows, pull the date from the appropriate field, convert it from a string to a Date() and put that into the option.

I think I am going to use the .click() function to accomplish this. So far this is what I have come up with:

$( 'input[id^="event_"]' ).click(function() {
    //input format: 2011-09-15 20:30:00
    var mainSplit = $(this).val().split(" ");
    var dateSplit = mainSplit[0].split("-");
    var timeSplit = mainSplit[1].split(":");

    //alert($(this).val());
});

Any pointers/suggestions/solutions are greatly appreciated!

  • 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-25T19:04:28+00:00Added an answer on May 25, 2026 at 7:04 pm

    You can simply pass the date string to JavaScript’s date constructor, and it’ll create a date for you:

    var theDate = new Date('2011-09-15 20:30:00'); // returns a date object
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a script that parses the pure-ftpwho -s command to get a list
I am writing a script that requires users to choose which parts of the
I'm currently writing a script that exports data from a list of tables and
I am currently writing a custom context menu class which utilizes jQuery largely. We
I'm writing a script that takes a list of files from a directory, opens
I am writing a script that will automatically click on the Waiting List button
I'm writing a script that saves a figure with multiple formatting styles among which
I'm writing a script that has to move some file around, but unfortunately it
I am writing a script that will look in a custom reports directory, copy
I am writing a script that checks if given domain is parked or not.

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.