Gossamer Forum
Home : Products : DBMan : Customization :

JPDeni - Date Translator is great !!!

Quote Reply
JPDeni - Date Translator is great !!!
I'Ve just tested the new universal date translator from JPDeni.
It's super great - thanks a lot !!!
You can put any date-format for searching
This is a comfort, I never found in the Internet.

I have another two suggestions:

1. We oldfashioned people in europe use
the format dd.mm.yy or dd.mm.yyyy
At the moment you can search this way
buy I could not store this format in the
database using dots as a delimiter
2. I is not possible to use a two-digit-year
in the search-frond-end. Most people
e.g. in germany would type dates this
way: 24.08.99

Dirk Petersen
Quote Reply
Re: JPDeni - Date Translator is great !!! In reply to
I'm glad it's working for you, at least part way. Smile

You can easily change the date format for the way dates are added to the database. Since you're using the date translator, you would change sub get_computed_date to:

Code:
sub get_computed_date {
# --------------------------------------------------------
# Returns the date in the format "dd.mm.yyyy".
# If you have changed your date format in sub get_date, you should also change it here.

my ($time) = $_[0];

$year = substr($time,0,4);
$mon = substr($time,4,2);
$day = substr($time,6,2);

unless ($day && $mon && $year) {
return undef;
}

return "$day.$mon.$year";
}

And replace sub get_date with the following:

Code:
sub get_date {
# --------------------------------------------------------
# Returns the date in the format "dd.mm.yyyy".
my ($time1) = $_[0];
($time1) or ($time1 = time());

my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time1);
($day < 10) and ($day = "0$day");
++$mon;
($mon < 10) and ($mon = "0$mon");
$year = $year + 1900;

return "$day.$mon.$year";
}

I intentionally made the date translator so it would only accept 4-digit years. I don't know if there's the same discussion in Germany about "Y2K" as there is in the US, but it made me really aware of the importance of including the full year.

It would take a great deal more coding to account for a two-digit year and it would also limit your database. Not so much this year, but next year it will be a real problem. It could be done if you thought it was absolutely necessary, but I would advise against it.

I would make a note on the form that years must be entered with all four digits.


------------------
JPD





Quote Reply
Re: JPDeni - Date Translator is great !!! In reply to
Hi Carol,

it works nice !!!

Now we we just lack the russian and
the canton chinese version :-)

It's funny, in Germany only 5 to 7 people
worry about Y2K (normally the Germans worry
about everything).
See what happens. The Germans might watch their atomic plants burning away and
in americans might shoot at each other at
12:00 fearing the big crash and the russians
won't notice it at all, because their computers run on diesel!