Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. // PHP program to display sunday as first day of a week
  2.  
  3. // l will display the name of the day
  4. // d, m and Y will display the day, month and year respectively
  5.  
  6. // For current week the time-string will be "sunday -1 week"
  7. // here -1 denotes last week
  8. $firstday = date('l - d/m/Y', strtotime("sunday -1 week"));
  9. echo "First day of this week: ", $firstday, "n";
  10.  
  11. // For previous week the time-string wil be "sunday -2 week"
  12. // here -2 denotes week before last week
  13. $firstday = date('l - d/m/Y', strtotime("sunday -2 week"));
  14. echo "First day of last week: ", $firstday, "n";
  15.  
  16. // For next week the time-string wil be "sunday 0 week"
  17. // here 0 denotes this week
  18. $firstday = date('l - d/m/Y', strtotime("sunday 0 week"));
  19. echo "First day of next week: ", $firstday, "n";
  20.  
  21. // For week after next week the time-string wil be "sunday 1 week"
  22. // here 1 denotes next week
  23. $firstday = date('l - d/m/Y', strtotime("sunday 1 week"));
  24. echo "First day of week after next week : ", $firstday;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement