jquery date and time picker - php

i am using jquery date and time picker in one my project where users can create an event. in the jquery datepicker, i have the option to select the today's date and future date and not the past date which is good for an event creattion website. but i am stuck with the time picker. for example, if i am in the event creation page(assume now time is 9.30am) and select date as 2010-08-05, then i click on the time field but the time field shows time that is already past i.e. time before 9.30, i cannot allow user to choose time that is before the current time. how can i valdiate this? or is there any way not to show the past time?
I am using php, if i decide to validate using php, how i am supposed to validate, which time I should use as base to check the user selected time? users can come from any country so how i am supposed to know which is past time for an user.
I use this http://labs.perifer.se/timedatepicker/, I use the first option and I can use the last option where users allowed to enter two fields which is good as we can know the duration and good thing is second field works based on the i/p in the first field but still this doesnt solve my past time issue.
please let me know if i am not clear.
regards

>> users can come from any country so how i am supposed to know which is past time for an user.
If I understand you well, the best way is to check at the client side(in javascript).
Here is the sample code .
$("#time").timePicker({
startTime:new Date() // pass the current time
});​
Then, the timePicker will omit the past and start from the current time.

Related

how to add date field in html showing like a calender

i am new to html and php i have created one railway ticket booking page in html .in that form page there are option where the user going to fill like start station,reach station and date, so how can i show date ,that is when the user click the date means it shows like a calender and the user select the appropriate date where planned to travel and i want to show next three month date from the current date like a calender. because we give permission to book the ticket before three month..so any one help me doing this in html..
and when the user select the date how can I get that selected date..
This can't be done in HTML alone, you need to use javascript, or even better, jQuery, which is a javascript library designed to simplify the creation of client-side scripts.
When using jQuery, as you can probably suspect, a lot of things already exist, including a date picker.
You can find more info on this page : http://jqueryui.com/datepicker/‎
I also encourage you to check out the other contents the jQuery UI site, as they are really useful to easily design richer forms.

Input Start Date and End Date to MYSQL Database

I am trying to create a webpage where users can input the start & end date and time for the DIV to appear. After it reaches the end date, the DIV will be deactivated until the users have input another start and end date and time. I have start date and end date column in my MYSQL database. How do I start ? Any hints? Or maybe better suggestions on how this works.
These are the requirements:
- Must allow the questionnaire to be released for a fixed time period
- Should allow the questionnaire to be issued more than once.
Have a look at http://www.php.net/manual/en/function.mysqli-connect.php
This will give you an idea. When you have your code you can come back to this site and ask concrete questions.
setInterval(function(){
$("#YOUR_DIV_ID").hide();
}, 60000);
You can use setInterval using JQuery to hide your DIV I have given 1 minute interval, Else you can remove your div using:
$("#YOUR_DIV_ID").remove();
This is the one of easy way.

multi datepicker to get dates from input field?

so my problem is this. I use the multi datepicker, http://multidatespickr.sourceforge.net/
for a site with news block. i save multiple dates for 1 news item and it works like a charm with php. BUT now my problem is, if someone wants to edit the news , I do get the current dates the news has, in a input field, but that isn't marked on the multi datepicker. problem here is, if they selected 30 dates, and want to exclude one after editing, they have to pick 29 dates again on datepicker, cause they wouldn't be active otherwise. my question here is, is there any way to make the datepicker get the dates from an input field ? FYI I get the same date formats both on getting and selecting from datepicker.
You'll have to show the context in which you use it, but the addDates parameter looks like it does what you want, so on instantiation you would pick up the list of dates from your input field and supply them in this parameter. See also how to pre-select dates.
I'm surprised the datepicker isn't permanently alive and just shows itself, in which case it would know what state it was in from last time it was hidden.
Update: reading even further it seems it uses the dates from an input field anyway. See this demo further in the instructions

How can I use the jQuery Datepicker UI to dynamically pull a list of available times for the specific date selected?

I want to be clear that I am not asking someone to write the code for me. I want to learn how to do this myself.
What I am trying to accomplish is this: I have a website where I need a user to be able to select a date and time for an appointment. What I would like to be able to do is have the user select a date from the jQuery DatePicker UI and use that selected date to dynamically populate a list of available time slots that I can display to the user so they can choose a time based on the available time slots. Similar to the way it's done on this page under step 3 - https://booking.maidsinblack.com/ .
I really want to learn this for myself, but I need a nudge in the right direction. I can get the jQuery DatePicker working on the page without an issue, but I am learning PHP/MySQL. What commands in PHP/MySQL will I need to send the chosen date from the calendar to PHP, use that to pull available times in MySQL, then send the related information back to the page for selection?
I really appreciate any help on this. Ive been searching Google for the past two hours attempting to find examples of what I am trying to do with no luck.

Jquery Plugins - date selector and crud(php mysql)

I am trying to find a date picker that can show dates to select starting current date so that the users don't select the past date and I need not worry about validating. I am not sure if this will show the correct date for any one from any place. I found some plugins but none of it has this option.
I found this http://jqueryui.com/demos/datepicker/#min-max but the restrict range option starts with 10-15 days before current date. I am expecting the date format to be 2010-06-28 as I have my other code on the site works based on this format.
I am trying to find a best example for php/mysql/jquery crud with these options
After a user logs in, I want to show his/her current list of items with "delete item, update/modify item, add a new item. I have a page for the "add new item" so the user can be navigated to that page and he can add a new item by filling a name, date and some more info.
Please help me out. Sorry if I cannot post questions asking for info without giving any code examples.
regards
The jQueryUI datepicker that you mentioned will do what you need it to. Set the options for the instance using the options below:
$(document).ready(function() {
$("#datepicker").datepicker({
minDate: +0,
dateFormat: 'yy-mm-dd'
});
});
This will start the date options with today and format the date as you specified the format needed to be. All you need to do is make sure the selector is correct by setting the correct ID for the input field.

Categories