Jump to content

Archived

This topic is now archived and is closed to further replies.

lilywong

Date Problem

Recommended Posts

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

[b]March / April 2006 [/b]

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

<? echo $today; ?> / April 2006

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

Share this post


Link to post
Share on other sites
[code]$thismonth = date("F");
$nextmonth = date("F", mktime(NULL, NULL, NULL, date("m") + 1, date("d"), date("Y")));

echo $thismonth . " / " . $nextmonth;[/code]

Share this post


Link to post
Share on other sites
Here's another method:
[code]<?php echo date('F') . '/' . date('F',strtotime('next month')) . ' ' . date('Y'); ?>[/code]

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.