Gossamer Forum
Home : Products : DBMan : Installation :

Change sub get_date

Quote Reply
Change sub get_date
Hi,

I changed the sub get_date routine to :
-------------------------------------------
sub get_date {
$time = @_[0];
($time) | | ($time = time());
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time);
# my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my (@months) = qw!janvier fevrier mars avril mai juin juillet aout septembre octobre novembre decembre!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;

return "$day $months[$mon] $year";
}
-------------------------------------------
and :
-------------------------------------------
sub date_to_unix {
my ($date) = $_[0];
my (%months) = ("janvier" => 0, "fevrier" => 1, "mars" => 2, "avril" => 3, "mai" => 4, "juin" => 5,
"juillet" => 6, "aout" => 7, "septembre" => 8, "octobre" => 9, "novembre" => 10,"decembre" => 11);
my ($time);
my ($day, $mon, $year) = split(/ /, $_[0]);
unless ($day and $mon and $year) { return undef; }
unless (defined($months{$mon})) { return undef; }
use Time::Local;
eval {
$day = int($day); $year = int($year) - 1900;
$time = timelocal(0,0,0,$day, $months{$mon}, $year);
};
--------------------------------------------
This works perfectly, except for some Netscape visitors, whom browser does not understand the "space" in the url such as :
-------------------------------------------
http://www.epocboulevard.com/cgi-bin/db/dbman.cgi?db=news&uid=default&Date=&Date-gt=24 novembre 1999&view_records=1&sb=2&so=descend&mh=3
--------------------------------------------
IE converts the "space" in "%20" which is Ok.

So, to be readable for everybody, I would like to put back the date format to :
---------------------------------------------
return "$day-$months[$mon]-$year";
---------------------------------------------

Unfortunately, althought I changed both routines, I get an "invalid date format" message.
The question is : do I have to modify the entered dates in the .db file (I did it, but I still get an error message.

Did I do something wrong ?
Could anybody help me ?

Many thaks in advance for any assistance ;o)




------------------
Psionist regards

Psionist
Quote Reply
Re: Change sub get_date In reply to
Spaces between dates is not the best...But it can be fixed with some regular expression codes. Don't have time to work on them now.

Sorry.

Yes, you will need to change all the date fields in your existing database to the new date format.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------