![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comparing two dates | guptan | Shell Programming and Scripting | 5 | 11-25-2005 11:46 AM |
| Comparing last modified dates | dmilks | Shell Programming and Scripting | 1 | 08-16-2005 10:01 PM |
| comparing dates | svh | High Level Programming | 2 | 07-19-2005 11:04 AM |
| comparing 2 dates | k_oops9 | Shell Programming and Scripting | 7 | 11-15-2004 02:07 AM |
| comparing 2 dates in Bourne shell | scmay | Shell Programming and Scripting | 1 | 04-28-2004 08:04 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
comparing dates
Hi guys
I have a a variable called check_ts which holds a date value. this date value keeps refreshing every 15 minutes. I am going to start a cron job 5 minutes after the refresh. I have to check if the current date > 20 min of check_ts. how do i do that. thanks ragha |
|
||||
|
cal_days Code:
#!/bin/perl
use Time::Local;
my $month=shift;
my $day=shift;
my $year=shift;
my $hour=shift;
my $min=shift;
my $sec=shift;
my $var=shift;
if ( "\u$var" =~ /PM/ )
{ $hour=$hour+12; }
my $time = timelocal(sec,min,hour,$day,$month-1,$year-1900);
my $time1 = timelocal(localtime());
my $days = ( $time1-$time ) / 60;
printf("%f", $days);
Code:
cal_days `echo $check_ts | sed -e "s/\// /g" -e "s/:/ /g"` |
![]() |
| Bookmarks |
| Tags |
| perl, perl shift, shift, shift perl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|