Jump to content


Photo

Date Problem


  • Please log in to reply
2 replies to this topic

#1 lilywong

lilywong
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 15 March 2006 - 03:06 AM

I want to dispaly this month, and next month together as below:

March / April 2006

i use :
<?
$today = date("F");
?>

<? echo $today; ?> / April 2006

How do i calculate so that i can also display the next month automatically ? thanks

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 15 March 2006 - 03:43 AM

$thismonth = date("F");
$nextmonth = date("F", mktime(NULL, NULL, NULL, date("m") + 1, date("d"), date("Y")));

echo $thismonth . " / " . $nextmonth;


#3 kenrbnsn

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

Posted 15 March 2006 - 03:53 AM

Here's another method:
<?php echo date('F') . '/' . date('F',strtotime('next month')) . ' ' . date('Y'); ?>

Ken





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users