in reply to start and end date for a week
By the way if your week starts on Monday instead of Sunday use this:#!/usr/bin/perl -w use strict; use DBI; my $dbh = DBI->connect('DBI:mysql:databasename','user','password') or +die "Couldn't open database: ". DBI->errstr . "\n"; my $sth = $dbh->prepare("SELECT date_format(?,'%V')"); my $rc = $sth->execute('2003-01-5'); my @temp = $sth->fetchrow_array; print "WEEK: $temp[0]\n"; exit;
Again, let me say that this is not the way to do it but it will work.my $sth = $dbh->prepare("SELECT date_format(?,'%v')");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: start and end date for a week
by Anonymous Monk on Dec 01, 2003 at 21:53 UTC | |
by ChrisR (Hermit) on Dec 01, 2003 at 22:17 UTC |