Welcome Guest, Not a member yet? Register   Sign In
Codeigniter calendar
#1

[eluser]DumpProgrammer[/eluser]
I was looking forward to using the codeigniter calender class for application only to realise that it shows the calendar but does not offer an input calendar.

I am developing a sample application and would like a user to have a drop down calendar and select a date from there. I am now looking for an alternative that will blend in well with codeignter.

Otherwise will anyone be able to give me a work around on inserting a date into Mysql DATE column. At the moment I have been restricted to entering the date as 2009-01-02 but I am in the UK where we accustommed to entering the date as 02-01-2010. Is there a way I can modify mysql column to take the values that way.
#2

[eluser]Craig A Rodway[/eluser]
[quote author="DumpProgrammer" date="1263228743"]I was looking forward to using the codeigniter calender class for application only to realise that it shows the calendar but does not offer an input calendar.

I am developing a sample application and would like a user to have a drop down calendar and select a date from there. I am now looking for an alternative that will blend in well with codeignter.[/quote]

Looks like you want a javascript date picker. The best ones are plugins for frameworks such as jQuery, Moo and Prototype.js.

[quote author="DumpProgrammer" date="1263228743"]Otherwise will anyone be able to give me a work around on inserting a date into Mysql DATE column. At the moment I have been restricted to entering the date as 2009-01-02 but I am in the UK where we accustommed to entering the date as 02-01-2010. Is there a way I can modify mysql column to take the values that way.[/quote]

No. Use the Y-m-d format for retrieving and storing, and use MySQL or PHP date functions to format it as you want. For example, to display it differently in PHP:

Code:
// Get from DB result row
$date = $row->date;
// Format it
echo date('d/m/Y', strtotime($date));
#3

[eluser]DumpProgrammer[/eluser]
Thanks for the reply so will I also be able to format the date to the mysql date before I insert it using Php date function.
#4

[eluser]Craig A Rodway[/eluser]
[quote author="DumpProgrammer" date="1263233077"]Thanks for the reply so will I also be able to format the date to the mysql date before I insert it using Php date function.[/quote]

Yes, just do it the other way round.

Code:
$data['date'] = date('Y-m-d', strtotime($this->input->post('date'));




Theme © iAndrew 2016 - Forum software by © MyBB