Canman2005 Posted April 9, 2007 Share Posted April 9, 2007 Hi all I have two varibles, one called $cycle_through_the_month and another called $display_month. "$cycle_through_the_month" displays a date, such as "5" for the 5th day, "18" for the 18th day and so on "$display_month" displays a month and year, such as "MARCH 2007" or "NOVEMBER 2007". Combined together like "$cycle_through_the_month $display_month" produces something like 2 APRIL 2007 or 26 JUNE 2007. What I want to do is to format these so that they print out like 02/12/2007 or 29/11/2007 Is this possible? Can anyone help? Thanks in advance Ed Link to comment https://forums.phpfreaks.com/topic/46293-solved-formatting-a-date/ Share on other sites More sharing options...
kenrbnsn Posted April 9, 2007 Share Posted April 9, 2007 Take a look at the functions strtotime() and date(). You can do something like: <?php echo date('m/d/Y',strtotime($cycle_through_the_month . ' ' . display_month)); ?> Ken Link to comment https://forums.phpfreaks.com/topic/46293-solved-formatting-a-date/#findComment-225246 Share on other sites More sharing options...
Canman2005 Posted April 9, 2007 Author Share Posted April 9, 2007 nice one Link to comment https://forums.phpfreaks.com/topic/46293-solved-formatting-a-date/#findComment-225265 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.