Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] date/time calculation tag?



******    message to minivend-users from jojo@buchonline.net     ******

On 28 Apr, Shozo Murahashi wrote:
> ******    message to minivend-users from "Shozo Murahashi" <murahashi@ayayu.com>     ******
> 
> HI all,
> 
> I would like to calculate the difference between dates.
> For example, the expiration date of the product's available.
> I mean that product catalog shows "This product expires in 30 days".
> 
> Is there this kind of MV tags or perl codes such as the follows?
> Life time = Expire_date - Current_time
> Expire_date = Begin_date + Life_time
> 
> What is the best way to this? Any suggention would be helpful.

Do you mean this?

---------snipp--------
#!/usr/bin/perl
use Time::localtime;
use Time::Local;
my $expiredate = localtime(timelocal(00, 00, 00 , 10, 05, 2000));
$expiredate = $expiredate->yday;
print "expiredate : " . $expiredate . "\n";
my $current_time = localtime;
$current_time = $current_time->yday;
print "current_time : " . $current_time . "\n";

my $lifetime = $expiredate - $current_time;
print "lifetime : " . $lifetime . "\n";


print "This product expires in " . $lifetime . " !\n";
---------snipp--------

---------snipp--------
server:/home/mvend[mvend]# date
Fr  28 Apr 2000 17:04:36 CEST
server:/home/mvend[mvend]# bin/testz.pl
expiredate : 161
current_time : 118
lifetime : 43
This product expires in 43 !
server:/home/mvend[mvend]# 
---------snipp--------

Regards,

	Joachim


-- 
Hans-Joachim Leidinger
buch online                 jojo@buchonline.net
Munscheidstr. 14            FAX: +49 209 1671449
45886 Gelsenkirchen         FAX: 0209 1671449

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: