Gossamer Forum
Home : Products : DBMan : Customization :

Question about the universal date mod of JPDeni

Quote Reply
Question about the universal date mod of JPDeni
Maybe someone else can help me also...

The mod converts the date entered in a lot of formats into a format readable by DBman (stated in the mod description).

What exactly is the format readable by DBman?

I have an outside script to write the database file, instead of the DBman script. But, since I wans users to enter their birthdate, and convert the date entered in the DBman format, I'd need to know exactly what is the format used in the database file.

With my original DB, it's always dd-mmm-yyyy

Do the universal date convert mod writes the date in the file with the format dd-mmm-yyyy? I can read in the mod this line:

$time= $year . $month . $day;

Does that means that now the script writes in the file something like 1999.05.27 ? or 1999.5.27? or 1999 . 5 . 27?

Sorry for asking this, but I think it's better to ask then reconfigure a complete database just to test this

Thanks

Etienne

Quote Reply
Re: Question about the universal date mod of JPDeni In reply to
In the default configuration in sub get_date the format is: "dd-mmm-yy".

and your date would be viewed as this line states:

return "$day-$months[$mon]-$year";

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Question about the universal date mod of JPDeni In reply to
There is the get_date code...

The get date returns a date in the format 05-may-2001

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!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;

return "$day-$months[$mon]-$year";

========

But what I need to know is the format that the date is printed in the .db file. So I can get the date written in the same format from my other script.. Or is there a way to have the script convert a date written in different order? Example, my .db file would be written as 2001-05-05 then the db script would convert it as being year-month-day.

Etienne

Quote Reply
Re: Question about the universal date mod of JPDeni In reply to
You need to alter both sub get_date and sub get_computed_date (from the mod file) to match your date format.

The purpose of sub get_computed_date is to translate the date in whatever format your users enter into whatever format you want to be in your .db file.

If you want a format of yyyy-mm-dd, then, in sub get_computed_date change

return "$day-$months[$mon]-$year";

to

return "$year-$mon-$day";

Also, delete the lines

--$mon;
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;

Also change sub get_date

After

$year = $year + 1900;

add

++$mon;
($mon < 10) and ($mon = "0$mon");

Change

return "$day-$months[$mon]-$year";

to

return "$year-$mon-$day";

JPD
http://www.jpdeni.com/dbman/