Jump to content

Recommended Posts

<?php

$d_daysinmonth = date('t', mktime(0,0,0,$myMonth,1,$myYear));    // how many days in month

$d_year = date('Y', mktime(0,0,0,$myMonth,1,$myYear));        // year

$d_isleapyear = date('L', mktime(0,0,0,$myMonth,1,$myYear));    // is YYYY a leapyear?

 

$d_firstdow = date('w', mktime(0,0,0,$myMonth,'1',$myYear));    // FIRST falls on what day of week (0-6)

$d_firstname = date('l', mktime(0,0,0,$myMonth,'1',$myYear));    // FIRST falls on what day of week Full Name

 

$d_month = date('n', mktime(0,0,0,$myMonth,28,$myYear));        // month of year (1-12)

$d_monthname = date('F', mktime(0,0,0,$myMonth,28,$myYear));        // Month Long name (July)

$d_month_previous = date('n', mktime(0,0,0,($myMonth-1),28,$myYear));        // PREVIOUS month of year (1-12)

$d_monthname_previous = date('F', mktime(0,0,0,($myMonth-1),28,$myYear));    // PREVIOUS Month Long name (July)

$d_month_next = date('n', mktime(0,0,0,($myMonth+1),28,$myYear));        // NEXT month of year (1-12)

$d_monthname_next = date('F', mktime(0,0,0,($myMonth+1),28,$myYear));        // NEXT Month Long name (July)

$d_year_previous = date('Y', mktime(0,0,0,$myMonth,28,($myYear-1)));        // PREVIOUS year

$d_year_next = date('Y', mktime(0,0,0,$myMonth,28,($myYear+1)));        // NEXT year

 

$d_weeksleft = (52 - $d_weekofyear);                    // how many weeks left in year

$d_daysinyear = $d_isleapyear ? 366 : 365;                // set correct days in year for leap years

$d_daysleft = ($d_daysinyear - $d_dayofyear);                // how many days left in year

?>

Link to comment
https://forums.phpfreaks.com/topic/52773-1st-of-the-month/#findComment-260544
Share on other sites

Hi

 

One other question:

 

I'm using the code below to selct the 1st of next month,

How do i make it so the month is in double figures?

 

$myMonth = date('m', $day);
$myYear = date('Y', $day);
$d_month_next = date('n', mktime(0,0,0,($myMonth+1),28,$myYear));
$first_next = date('Y/'.$d_month_next.'/01');
echo $first_next;

 

This prints out - 2007/6/01

 

I need it to print out 2007/06/01

 

 

Thanks once again

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/52773-1st-of-the-month/#findComment-260553
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.