Gossamer Forum
Home : Products : DBMan : Customization :

Compare Dates

Quote Reply
Compare Dates
Hi Carol..a quick question...
I Have two Dates (both defined)

if ($rec{'Date'} > $rec{'Date2'}) {

doesn't seem to work as above...
am I missing something here?

thanks Rob
Quote Reply
Re: Compare Dates In reply to
The problem is that you need to define this fields not in raw month-day-year format, but in the date_to_unix format to do calculations.

What you can try is the following:

1) Add the following codes at the top of your sub html_record routine before the print qq| code:

Code:
$rec{'Date'} = &date_to_unix(&get_date);
$rec{'Date2'} = &date_to_unix(&get_date);

2) Then you can use the comparison codes you have....

Code:
if ($rec{'Date'} > $rec{'Date2'}) {

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Compare Dates In reply to
Hi Eliot...I used the code you suggested, however both dates are returned as the same 9 digits although the dates are different...plus how do you convert the 9 digits back to regular 18-Apr-2000 format...thanks Rob
Quote Reply
Re: Compare Dates In reply to
Eliot had it a little off.

Code:
$compare1 = &date_to_unix($rec{'Date'});
$compare2 = &date_to_unix($rec{'Date2'});

Then use

Code:
if ($compare1 > $compare2) {
do something;
}


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






Quote Reply
Re: Compare Dates In reply to
Oops...sorry about that JPDeni...

Thanks for correcting my errors.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Compare Dates In reply to
Hi Guys....thank you both...Rob
Quote Reply
Re: Compare Dates In reply to
You're welcome.

BTW: JPDeni is a gal...

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Compare Dates In reply to
 
Quote:
I'm using the word Resume with the accent in a mail script

Can't you just use Resume\'?

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Compare Dates In reply to
Rob:

Check out this thread it provides a solution for effectively using special characters:

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/002413.html

Hope this helps Smile
Quote Reply
Re: Compare Dates In reply to
Very good ..thanks to all...Rob
Quote Reply
Re: Compare Dates In reply to
That's okay. I'm just one o' the guys. Smile

And, Eliot, we have to keep an eye on each other. I know all too well how easy it is to make mistakes. I do it all the time. Smile

You're welcome, Rob.

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






Quote Reply
Re: Compare Dates In reply to
Hi Eliot...I'm using the word Resume with the accent in a mail script..but it diplays as Resum & eacute (without the spaces) not as it should..it tried \ but that doesnt help...a simple but frustrating little glich...thanks Rob.

[This message has been edited by Rob (edited April 29, 2000).]