• BOOKMARK

  • ADD TO FAVORITES

  • REFERENCES


  • MARC

    Mailing list ARChives
    - Search by -
     Subjects
     Authors
     Bodies





    FOLDOC

    Computing Dictionary




  • Text Link Ads






Using the PHP mktime Function

PHP Tutorials.

Using the PHP mktime Function

New postby Ranman on Thu Mar 27, 2008 10:42 pm

Code: [Select all] [Expand/Collapse] [Download] (Untitled)
<?php
$yesterday = mktime(0,0,0,date("m"),date("d")-1,date("Y"));
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$tomorrow  = mktime(0,0,0,date("m"),date("d")+1,date("Y"));
$lastmonth = mktime(0,0,0,date("m")-1,date("d"),date("Y"));
$nextmonth = mktime(0,0,0,date("m")+1,date("d"),date("Y"));
$lastyear = mktime(0,0,0,date("m"),date("d"),date("Y")-1);
$nextyear = mktime(0,0,0,date("m"),date("d"),date("Y")+1);
// The "t" below gives the number of days in a given month.
$lastday = mktime(0,0,0,date("m"),date("t"),date("Y"));

$yesterday = strftime("%A %B %d, %Y",$yesterday);
$today = strftime("%A %B %d, %Y",$today);
$tomorrow = strftime("%A %B %d, %Y",$tomorrow);
$lastmonth = strftime("%A %B %d, %Y",$lastmonth);
$nextmonth = strftime("%A %B %d, %Y",$nextmonth);
$lastyear = strftime("%A %B %d, %Y",$lastyear);
$nextyear = strftime("%A %B %d, %Y",$nextyear);
$lastday = strftime("%A %B %d, %Y",$lastday);
echo "<b>Yesterday was:</b> $yesterday<br />";
echo "<b>Today is:</b> $today<br />";
echo "<b>Tomorrow is:</b> $tomorrow<br />";
echo "<b>Last Month was:</b> $lastmonth<br />";
echo "<b>Next Month is:</b> $nextmonth<br />";
echo "<b>Last Year was:</b> $lastyear<br />";
echo "<b>Next Year is:</b> $nextyear<br />";
echo "<b>Last day of the month is:</b> $lastday<br />";
?>


User avatar
Ranman
Site Admin
 
Posts: 25
Joined: Thu Mar 27, 2008 12:27 am

Re: Using the PHP mktime Function

New postby Joplin on Mon Dec 23, 2013 12:25 pm

PHP Offical Documentation
mktime
User avatar
Joplin
 
Posts: 12
Joined: Tue Apr 01, 2008 12:34 am


Return to PHP Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

  • MORE RESOURCE


  • Linux

    The Distributions





    Linux

    The Software





    Linux

    The News



  • MARKETING






  • Toll Free
cron