PHP date get last Sunday

PHP date get last Sunday


Posted in : PHP Posted on : January 27, 2011 at 6:53 PM Comments : [ 0 ]

In this tutorial you will learn how to find PHP date of last sunday in a PHP web application.

PHP date get last Sunday

In this tutorial you will learn how to find PHP date of last sunday in a PHP web application. In this tutorial  $date variable  first assign current date and again use  strtotime() function that return Unix timestamp . When pass parameter in  strtotime($date.'last sunday') dunction then it return's last Sunday Unix timestamp  and last it's value pass in date()  with date format , it get date last Sunday . The code of "php-date-get-last-sunday.php" given below as :   

<?php
$date=date("Y-m-d");
echo "Current Date : ".$date."<br>";
echo "last Sunday : ".date('Y-m-d', strtotime($date.'last sunday'));
?> 

Output :

When run "php-date-get-last-sunday.php"  display output as :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics