mysty Posted March 23, 2007 Share Posted March 23, 2007 <?php echo $_SESSION['MY_date'] ?> This is line of code that gets a date from a session variable. The session variable, MY_date, comes from a database DATE field. The output is like this: 2007-01-01. What I want the output to look like is this: January 1, 2007. How do I do that? or what changes are needed in the above code? Link to comment https://forums.phpfreaks.com/topic/43991-formatting-dates-taken-from-database/ Share on other sites More sharing options...
JSHINER Posted March 23, 2007 Share Posted March 23, 2007 Just had the same issue: echo date("F j, Y",strtotime($_SESSION['MY_date'])); Link to comment https://forums.phpfreaks.com/topic/43991-formatting-dates-taken-from-database/#findComment-213579 Share on other sites More sharing options...
SharkBait Posted March 23, 2007 Share Posted March 23, 2007 echo date("F d, Y", strtotime($_SESSION['MY_date'])); bah I was beaten to it! Link to comment https://forums.phpfreaks.com/topic/43991-formatting-dates-taken-from-database/#findComment-213581 Share on other sites More sharing options...
mysty Posted March 23, 2007 Author Share Posted March 23, 2007 Thanks guy, it works like a charm. Link to comment https://forums.phpfreaks.com/topic/43991-formatting-dates-taken-from-database/#findComment-213854 Share on other sites More sharing options...
Kasuke_Akira Posted March 23, 2007 Share Posted March 23, 2007 Wow, that would make things eaasier. all u have to do is store one format and u can convert it to any you need. Link to comment https://forums.phpfreaks.com/topic/43991-formatting-dates-taken-from-database/#findComment-213857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.