379715 visitors has seen the Tim-Carter.com site. Thanks!
320 visitors has seen the Tim-Carter.com site today.
 
 
Search :  
 
>>> Programming >> PHP > How to find the first (1st) day in a week with PHP Date (This page has been seen 966 times)

How to find the first (1st) day in a week with PHP Date

Lets say you want to find the date of the first day in the current week. You could do something like this

The Code:
define('ONE_DAY', 60*60*24);
$WeekDayNumber = date('w');
$WeekBegin = date("m/d/y",time() - ($WeekDayNumber - 1)*ONE_DAY);

echo $WeekBegin;

Like (4)
 
Dislike (1)


Keywords for this article:
DATE || WEEK || TIME

Post comment

Name:


Comment:

Code Language:

Code:

Here you can paste a code example. It will then be processed by SyntaxHighlighter and formatted for easier readability.
Please remember to select the correct Code Language in the select above so the SyntaxHighlighter can highlight the code properly.




Code:

Please enter the code you see above

What is 5 + 6 =

Submit Comment


No one has commented on this page yet. You could be the first.


Advertisement by Google


Sponsors :