----- Original Message -----
From: "Jenda Krynicky" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, September 19, 2001 11:21 AM
Subject: Re: ODBC- How to get the difference between two dates


> > Dear All,
> >           Can anyone please give me some idea to get the no of days
> >           between
> > two dates like 12-jan-01 and 14-jan-01
> >           Please help me.
>
> Since you included ODBC in the subject I assume you get the
> dates from the database ...
>
> Depending on what is the SQL server you might be able to do it
> within SQL
>
> For example in MS SQL Server you have DateDiff() :
>
> select datediff(day, '2001-01-01', '2002-01-01')
>
> If you want to get the difference within Perl look at the Date::...
> modules at http://search.cpan.org
>
> Jenda
I agree. One of the problems I've had to deal with is the different database
generated date formats on different database servers. My tendancy is to
store time stamps in time() format. This makes them portable across servers,
and also makes for easy mathematical operations and formatted output using
localtime() to extract the date information, or the result of date
operations.

ego
Edward G. Orton, GWN Consultants Inc.
Phone: 613-764-3186, Fax: 613-764-1721
email: [EMAIL PROTECTED]

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to