DanielWhite Posted June 3, 2008 Share Posted June 3, 2008 I was trying to get the last month with this code: echo date('June', strtotime('-1 month')); I know your supposed to use 'F' but I need some way of having the full month name to work with it. Anyone know? Anyway the result of that echo brings up this: J0000005America/New_York What does this mean? Link to comment https://forums.phpfreaks.com/topic/108521-is-php-supposed-to-show-this-j0000005americanew_york/ Share on other sites More sharing options...
samshel Posted June 3, 2008 Share Posted June 3, 2008 using 'F' will give you a full month name. echo date('F', strtotime('-1 month')); Something else needs to be done? Link to comment https://forums.phpfreaks.com/topic/108521-is-php-supposed-to-show-this-j0000005americanew_york/#findComment-556432 Share on other sites More sharing options...
ikmyer Posted June 3, 2008 Share Posted June 3, 2008 <?php echo date('June', strtotime('-1 month')); ?> was evaluating each letter of June so like... J = u = Milliseconds (added in PHP 5.2.2) Example: 54321 n = Numeric representation of a month, without leading zeros 1 through 12 e =Timezone identifier (added in PHP 5.1.0) Examples: UTC, GMT, Atlantic/Azores Link to comment https://forums.phpfreaks.com/topic/108521-is-php-supposed-to-show-this-j0000005americanew_york/#findComment-556449 Share on other sites More sharing options...
jonsjava Posted June 3, 2008 Share Posted June 3, 2008 here's something that will show you the previous month: <?php $lastmonth = date("n") - 1; function getmonth($month) { return (($month==0 ) ? date("F") : date("F", mktime(0,0,0,$month))); } print getmonth($lastmonth); ?> Link to comment https://forums.phpfreaks.com/topic/108521-is-php-supposed-to-show-this-j0000005americanew_york/#findComment-556516 Share on other sites More sharing options...
kenrbnsn Posted June 3, 2008 Share Posted June 3, 2008 Why go through all that when the strtotime function works just fine: <?php $lastmonth = date('F', strtotime('-1 month')); echo $lastmonth; ?> Ken Link to comment https://forums.phpfreaks.com/topic/108521-is-php-supposed-to-show-this-j0000005americanew_york/#findComment-556524 Share on other sites More sharing options...
jonsjava Posted June 3, 2008 Share Posted June 3, 2008 because I just woke up, and didn't stop to think simple *sigh*. Link to comment https://forums.phpfreaks.com/topic/108521-is-php-supposed-to-show-this-j0000005americanew_york/#findComment-556525 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.