Dear all,

I'm a beginner and I try to find a way to have a date field call it
'mydate' and I want to display it as a normal textfield (not the dd -
mm -  yyyy thing) in the german format.

In the MySQL database I have a datefield with yyyy-mm-dd
im my edit and add view I have a code like:
...
$value=date('d.m.Y', strtotime($this->data['Post']['mydate']));

echo $this->Form->input('mydate', array('type'=>'text','dateFormat' =>
'DMY','label' => 'My Date', 'value'=>$value));
...

to display the date in the correct format

But if I fill in a date like 20.01.2012 it gets saved as 2020-01-20
which means it takes just the first 2 digits of the year as the day
and the date as the year.

I have a call
 $this->data['Post']['mydate'] = date('Y-m-d', strtotime($this-
>data['Post']['mydate']));
in the PostsController.php
but this doesn't work out.

I thought there might be a build in function in Cake since this seems
to be a basic problem but I can't find anything (helpfull for me).

Can anyone out there help me with this?

Extra Question:
I like to use a datepicker and I can't find any which helps me out
with this.
Maybe because of the problem above...

Thanks in advance

Christian Schulte

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to