Gossamer Forum
Home : Products : DBMan : Discussions :

Date Format for DBMan - Help!

Quote Reply
Date Format for DBMan - Help!
Hello All. I'm considering purchasing DBMan for our company. I have a form/perlscript combo which I'd like to write the DBMan datafile. Mostly, users are going to use DBMan to read/sort the data and use the Excel export mod.

My problem is that sorting and searching by Date is going to be very important, and it isn't working! My database has a date field defined, and I can add a record with no problem. It uses the 6-Aug-2000 format. But I don't know to write a date in that format to my database using my form.

I realize this might be more of a Unix/Perl question. Right now I'm writing the date like this through my perlscript:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$Date = $mon . "-" . $mday . "-" . $year;

This writes the date in the 8-26-2000 format and works ok. But DBMan doesn't like it!

So finally.... my question... How do I write a date so that DBMan will read it as a valid date field/format?

And after I've got the date written properly... when I'm doing a DBMan search, do I have to actually spell out the date in the 26-Aug-2000 format?

Or to search a range, do I use >26-Aug-2000 to show records after that date?

Thanks very much. I appreciate the help.

Quote Reply
Re: Date Format for DBMan - Help! In reply to
I haven't tried this one but I think that you need to edit the 'sub get_date' in db.cgi to get the correct format - you will also need to edit the 'sub date_to_unix'.

Good Luck!

Keef

Quote Reply
Re: Date Format for DBMan - Help! In reply to
braddock:

You may want to check the FAQ noted below under the topic "Dates" where you will find various thread references to working with dates.

I'm sure you will find the answers to your questions there {smile}

There are several examples within the threads. You may also want to check out the "Universal Date Translator Mod" in the resouce center to see if it is something you could use.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Date Format for DBMan - Help! In reply to
LoisC. Thanks. I installed the Universal Translator and met with some success... DBMan is able to conduct a range search using "American" date formats and return the correct result from my database which uses American dates.

However, when I simply enter a search for an "American" date, it doesn't work... very weird, says there is no match.

This is pretty frustrating. Is there a way to just convert DBMan over to American dates as the default without these mods? I saw a thread on that and tried to implement it, but the posted code gave me an error on the ++mon; line in the revised sub getdate he proposed. Help!!

Help!

Quote Reply
Re: Date Format for DBMan - Help! In reply to
You can easily modify the date format display by making the modifications in both

sub get_date

and

sub date_to_unix

Did the thread you mentioned also note how the date_to_unix needed to be modified?

Perhaps you could post your two subs here so they can be viewed ... i'm sure someone will be able to help you get it working.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/