Page 1 of 1

finding the nearest date()

Posted: Fri Jan 14, 2005 12:30 am
by pelegk2
say i am on friday or saturday
and i want to find the closest sunday or last fridat date's
how can i do it?
thnaks in advance
peleg

Posted: Fri Jan 14, 2005 1:17 am
by rehfeld
strtotime() makes it pretty easy

first thanks

Posted: Fri Jan 14, 2005 1:31 am
by pelegk2
second i tried to find :
have a look at the GNU manual page titled Date Input Formats.
and the given link isnt working :(
now maybe another place to look for then the given link in the manual?

third : for example here it now friday and i did :

Code: Select all

strtotime ("near Sunday")
and instead of reciving 16/1/2005 i recived 23/1/2005
why is that?
thnaks in advance
peleg

Posted: Fri Jan 14, 2005 8:19 am
by feyd

Code: Select all

<?php

	echo date('Y-m-d', strtotime('-1 week last thursday')) . "\n";
	echo date('Y-m-d', strtotime('next sunday')) . "\n";
	echo date('Y-m-d', strtotime('this sunday')) . "\n";

?>

Code: Select all

2005-01-06
2005-01-23
2005-01-16

first thnaks alot

Posted: Sun Jan 16, 2005 1:39 am
by pelegk2
second where can i find : the
"Date Input Formats"?
thnaks in advance
peleg

Posted: Sun Jan 16, 2005 7:32 am
by feyd