|
|
sybperl-l Archive
Up Prev Next
From: mpeppler at itf dot ch (Michael Peppler)
Subject: Re: dbh->newdate function
Date: Feb 9 1996 3:30PM
> From: rsd@softaid.net (Tony Byorick)
>
> I want to perform date calculations in Perl (i.e. subtracting one date from
> another, etc) and was going to ask if any date handling packages are
> availible for Perl when the following message was posted:
>
> >> From: kkitts@uhd2.uhd.com (Kevin Kitts)
> >> I am trying to use a call that I saw at the Sybperl website...
> >>
> >> $date = $dbh->newdate('Jan 1 1995');
> >>
>
> Does this mean that I can access Sybase's date handling logic via a call
> from Perl? If so, is this capability availible in version of Perl prior to 5.0?
>
Yes, and no.
Yes, you can access (a certain form of) the Sybase date handling
routines from perl, but this only available in the Sybase::CTlib module
(requires perl5.001m or better).
The available calls are:
@arr = $date->crack; # Calls cs_dt_crack().
$date2 = $date1->calc($days, $msecs); # add/substractdays and
milliseconds to $date1.
($date, $msecs) = $date1->diff($date2); # number of days/millisecs
between date1 and date2.
You can also convert a Sybase date (which has a base value of January 1
1900) to a Unix time_t value using one of $date->mktime,
$date->timelocal, $date->timegm.
Michael
|