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.
Last seven days date value we can find out by using a for loop.
Here is the output of the code. 18-01-21:Mon 17-01-21:Sun 16-01-21:Sat 15-01-21:Fri 14-01-21:Thu 13-01-21:Wed 12-01-21:Tue 11-01-21:Mon 10-01-21:Sun 09-01-21:Sat 08-01-21:Fri 07-01-21:Thu 06-01-21:Wed 05-01-21:Tue 04-01-21:Mon 03-01-21:Sun Here is the code.
Using strtotime()We can create unixtime stamp from text string by using strtotime() Output is here
This article is written by plus2net.com team.
![]() | ||||||||||||||||||||
| ||||||||||||||||||||