Jump to content


Photo

Date question


  • Please log in to reply
1 reply to this topic

#1 Acs

Acs
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationLisbon, Portugal

Posted 25 March 2006 - 12:56 AM

Is there any way to convert something like 2006-03-24 to a string like 2006 March Friday. Does php have something like this or do I have to make something that can handle this?
Php/Mysql newbie - www.antoniocs.org

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 25 March 2006 - 01:53 PM

Did you look in the online manual at [a href=\"http://www.php.net\" target=\"_blank\"]http://www.php.net[/a]?

A quick search would have revealed the [a href=\"http://www.php.net/date\" target=\"_blank\"]date[/a]() and [a href=\"http://www.php.net/strtotime\" target=\"_blank\"]strtotime[/a]() functions.

<?php
$str = '2006-03-24';
echo date('Y F l',strtotime($str));  // the l is a lowercase L, not a captal I or 1
?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users