Yii Framework Forum: Problem with data - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem with data Rate Topic: -----

#1 User is offline   kitty10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 139
  • Joined: 13-April 10

Posted 26 April 2010 - 04:12 AM

I have a problem with the dates ... I downloaded the extension Yii calendar .. but when I save in the db by mistake ...
I have to save the date 01-Jul-03, for example, but rather save as 6 - July-2010 ..
how can I change the format?
0

#2 User is offline   Jaz Manister 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 109
  • Joined: 27-October 09
  • Location:Rural Western New York, USA

Posted 26 April 2010 - 08:48 AM

View Postkitty10, on 26 April 2010 - 04:12 AM, said:

I have a problem with the dates ... I downloaded the extension Yii calendar .. but when I save in the db by mistake ...
I have to save the date 01-Jul-03, for example, but rather save as 6 - July-2010 ..
how can I change the format?



if(!empty($_POST['model']['datefield'])) 
    $_POST['model']['datefield'] = date('j-F-Y', strtotime($_POST['model']['datefield']));




That's one way I've been dealing with this situation. I use something like this in the create and update actions. I'd be curious to see a different way to solve this, but this at least works.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users