Getting yesterday and previous days date valuesYou must have seen how to get today date by using date function. By changing the date value we can get the dates of yesterday. Same way we can extend this to get date values of last 7 days. Or we can extend this to get dates between any to differences.
Let us find out the date value of yesterday.
$m= date("m"); // Month value
Last seven days date value we can find out by using a for loop.
Here is the output of the code.
Click for more tutorial on Date & Time functions and Applications
PHP Date & Time functions
PHP Date Timestamp and generating date & time in different formats
Validating Date: Checking if date is correct or not by using checkdate()
PHP Date Today: Getting current date, week day and month
PHP yesterday and previous 7 days from today
Vaious date formats to use in date function and class
Time stamp generator: Use any date and time and generate timestamp
Date selection drop down list box for users to select
mktime function to generate time stamp
Difference in Two dates by using mktime function
Finding month, weekday, day of the year etc for any date value
Breaking the date string to get month date and year using array
More On Date Object
PHP Date & Time class creating and examples of uses
Creating a date interval object and using with php date object
Adding date interval to date object to create new dates
Difference in date by using diff function and using date object
Add or subtract from date object using modify function
Changing parameters of the date object by using setdate function
updating time for a date object to a new value
Gettign the time zone setting of the server
Setting the default time zone of server
Array of time zones available for setting ( total list )
Getting time in seconds elapsed from Epoch time
Local time of the server or different time zones by using localtime() function