[ create a new paste ] login | about

Link: http://codepad.org/NnqZTDxc    [ raw code | output | fork ]

PHP, pasted on Dec 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

date_default_timezone_set('Europe/Amsterdam');

$date = new DateTime();

$date->modify('first day of this week');
echo 'First day of this week: '.$date->format('Y-m-d')."\n";

$date->modify('first day of week 50');
echo 'First day of week 50: '.$date->format('Y-m-d')."\n";

$date->modify('last day of this week');
echo 'Last day of this week: '.$date->format('Y-m-d')."\n";

$date->modify('last day of week 50');
echo 'Last day of week 50: '.$date->format('Y-m-d')."\n";


Output:
1
2
3
4
First day of this week: 2011-12-18
First day of week 50: 2011-12-19
Last day of this week: 2011-12-18
Last day of week 50: 2011-12-17


Create a new paste based on this one


Comments: