View Full Version : insert data for every friday
ynotlim
07-19-2007, 08:01 PM
Hello
I have a table and want to insert the dates every friday from today until June 30th. ie 2007-07-20, 2007-07-27 and so on......
for (today until june 30){
INSERT INTO table VALUES(null,"every friday",null);
}
thanks in advance
fuzzy1
07-19-2007, 09:56 PM
Don't know if this will help but in php you might try something like (http://us2.php.net/strtotime):
<?php
$year = date('Y');
$everyFriday = array();
$start = strtotime("first friday jan $year");
$te = (7 * (3600*24));
$x=0;
$f=0;
while($x<=52){
$f += $te;
++$x;
$everyFriday[] = ($start+$f)."\n";
}
foreach ($everyFriday as $key => $value) {
$date = date("Y-m-d", $value);
echo $date .'<br>';
}
?>
ynotlim
07-19-2007, 10:38 PM
thanks! But i was hoping for a solution without having to code in php/perl/java.
guelphdad
07-20-2007, 12:09 AM
See this article (http://searchoracle.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid41_gci1264603,00.html) registration is free. it gives you exactly what you are looking for.
ynotlim
07-20-2007, 01:20 AM
thanks for the help, but can you give me the solution w/out me having to sign-up?
Thanks
Tony
guelphdad
07-20-2007, 02:54 AM
and you aren't going to sign up because?
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.