Yii Framework Forum: Parse a string to a date format - Yii Framework Forum

Jump to content

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

Parse a string to a date format Rate Topic: -----

#1 User is offline   Stijn 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 04-February 09
  • Location:Belgium

  Posted 29 March 2010 - 03:45 AM

Why can I not parse a string to a date?

I use this function:

<?= CDateTimeParser::parse('2009-11-11 21:18:09','dd/MM/yyyy'); ?>

0

#2 User is offline   Yaroslav 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 28-March 10
  • Location:Moscow, Russia

Posted 29 March 2010 - 07:08 AM

try
CDateTimeParser::parse('2009-11-11 21:18:09','yyyy-MM-dd hh:mm:ss');

0

#3 User is offline   Stijn 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 04-February 09
  • Location:Belgium

Posted 29 March 2010 - 07:15 AM

 Yaroslav, on 29 March 2010 - 07:08 AM, said:

try
CDateTimeParser::parse('2009-11-11 21:18:09','yyyy-MM-dd hh:mm:ss');




Oh, the last string is the format for the input value, not for the output format?
0

#4 User is offline   Yaroslav 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 28-March 10
  • Location:Moscow, Russia

Posted 29 March 2010 - 07:16 AM

http://www.yiiframew...CDateTimeParser
"CDateTimeParser converts a date/time string to a UNIX timestamp according to the specified pattern."
"To format a timestamp to a date string, please use CDateFormatter."
http://www.yiiframew.../CDateFormatter
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