views:

38

answers:

2

I am working on form and I am looking for a free calendar/date/timestamp app that i can include in my form. basically, in the input text, i want users to click on the calendar icon and pick a date and a time stamp. that value should populate in the input text.

my next question is, in my mysql db, i am calling this field as "datetime", so i am hoping the values can be written in the db.

i am working with php and mysql.

thanks.

A: 

This can be done with GUI

Take a look at jQuery UI Date-picker: http://jqueryui.com/demos/datepicker/

Regards to the date conversion there is plenty of functions to help you

http://www.php.net/manual/en/ref.datetime.php

RobertPitt
great, how about the timestamp? users are allow to pick a date, and a time in my application. thanks.
Menew
A: 

For the user interface you are describing to be added to the input field, jQuery Datepicker springs to mind.

http://jqueryui.com/demos/datepicker/

You'll need to include the jQuery library as well as the jQuery UI library. You can use the 'build your download' link and documentation on the jQuery library page to get a fully themed ui download to suit your design needs.

You'll need to make your form post to a server-side script that will take the field and insert it into the DB. Be careful - mysql date time is in the following format - YYYY-MM-DD HH:mm:SS. You can use strtotime and date to format the input from jQuery. After sanitizing the input, you could do something simple like:

date('Y/m/d H:i:s', strtotime($_POST['date']) )

You can use this to make sure in your server script that the date/time is in the proper format before it goes in the database.

DeaconDesperado
thank you the date formating helped. i was able to insert into mysql.
Menew