I can determine 'seconds since Epoch' on a file modification
Touch'ed another file a little later - note greater number
Now I can see that 35 seconds actually elpased
So, by extension, you could touch a temp file (like my file287) and then compare the number of seconds difference. Just do the math to figure out how many seconds in your desired elapsed time period.
Last edited by joeyg; 10-22-2008 at 12:03 PM..
Reason: corrected spelling
I have a log file with date format like
10-Oct-02 13:20:29 .....
at the beginning of each line in the log file, and I need to grep data from this file to list the lines with date no longer than one days.
I tried to use awk to do this but it looks very complicated to do it.
Is there... (6 Replies)
Hi
I am writing a unix program. In that, i should compare two dates.
I would like to know how to compare two dates in unix-whether they are same or not.
pls help (5 Replies)
Hi Gurus
I am getting the timestamp of the last generated log file
its like this "Oct 31 10:26"
I want to compare this timestamp with the current date in shell script. I want to compare if the
(timestamp-currentime) > 10 minutes
how do i do this.
Thanks
Ragha (2 Replies)
hi all :)
how can in compare yyyy/dd/mm with yyyy/dd/mm in perl i want the result like grater than or less than the given date...
thanks in advance (3 Replies)
Need to find all records where date in one filed is greater than date in other.
Input:
ABC 2 Filed3 CDG * X 20080903 20081031 180.00
ABD 2 Filed3 CDG * X 20081101 20081031 190.00
ABE 2 Filed3 CDG * X 20090903 20081031 120.00
ABC 2 Filed3 CDG * X 20080903 20081015 130.00
Output:
... (2 Replies)
I want to compare a list of dates in a file with today's date & list only dates that are less than only 60 days old . please help . the date in the file are in format
11-FEB-2009
02-FEB-2009
26-JAN-2009
24-JAN-2009
13-JAN-2009
16-DEC-2008
10-DEC-2008
01-DEC-2008
25-NOV-2008
19-NOV-2008... (3 Replies)
Hi to all.
When you have to compare a lot of dates in a SH code, there is a way to directly compare? For example, how can I check if two dates differ in less than a week?
Thank's for reading. (2 Replies)
Hi,
I want to convert two datetime fields to find out if the difference is one hour, in linux I've done this by converting both the datetime values to unix epoch time and subtracting them to find out if the difference is more than 3600s, however this does not work in hp-ux.
I've these... (3 Replies)
Hi All,
I am entering StartDate and EndDate as parameters to script. Want to have an check saying, "If StartDate is greater than EndDate then don't execute the script".
Pseudo Code:
if
then
Execute script
else
exit 0
fi
Can you please help me on the same?
Thanks and... (4 Replies)
Discussion started by: Nagaraja Akkiva
4 Replies
LEARN ABOUT MOJAVE
date::parse
Date::Parse(3) User Contributed Perl Documentation Date::Parse(3)NAME
Date::Parse - Parse date strings into time values
SYNOPSIS
use Date::Parse;
$time = str2time($date);
($ss,$mm,$hh,$day,$month,$year,$zone) = strptime($date);
DESCRIPTION
"Date::Parse" provides two routines for parsing date strings into time values.
str2time(DATE [, ZONE])
"str2time" parses "DATE" and returns a unix time value, or undef upon failure. "ZONE", if given, specifies the timezone to assume when
parsing if the date string does not specify a timezone.
strptime(DATE [, ZONE])
"strptime" takes the same arguments as str2time but returns an array of values "($ss,$mm,$hh,$day,$month,$year,$zone)". Elements are
only defined if they could be extracted from the date string. The $zone element is the timezone offset in seconds from GMT. An empty
array is returned upon failure.
MULTI-LANGUAGE SUPPORT
Date::Parse is capable of parsing dates in several languages, these include English, French, German and Italian.
$lang = Date::Language->new('German');
$lang->str2time("25 Jun 1996 21:09:55 +0100");
EXAMPLE DATES
Below is a sample list of dates that are known to be parsable with Date::Parse
1995:01:24T09:08:17.1823213 ISO-8601
1995-01-24T09:08:17.1823213
Wed, 16 Jun 94 07:29:35 CST Comma and day name are optional
Thu, 13 Oct 94 10:13:13 -0700
Wed, 9 Nov 1994 09:50:32 -0500 (EST) Text in ()'s will be ignored.
21 dec 17:05 Will be parsed in the current time zone
21-dec 17:05
21/dec 17:05
21/dec/93 17:05
1999 10:02:18 "GMT"
16 Nov 94 22:28:20 PST
LIMITATION
Date::Parse uses Time::Local internally, so is limited to only parsing dates which result in valid values for Time::Local::timelocal. This
generally means dates between 1901-12-17 00:00:00 GMT and 2038-01-16 23:59:59 GMT
BUGS
When both the month and the date are specified in the date as numbers they are always parsed assuming that the month number comes before
the date. This is the usual format used in American dates.
The reason why it is like this and not dynamic is that it must be deterministic. Several people have suggested using the current locale,
but this will not work as the date being parsed may not be in the format of the current locale.
My plans to address this, which will be in a future release, is to allow the programmer to state what order they want these values parsed
in.
AUTHOR
Graham Barr <gbarr@pobox.com>
COPYRIGHT
Copyright (c) 1995-2009 Graham Barr. This program is free software; you can redistribute it and/or modify it under the same terms as Perl
itself.
POD ERRORS
Hey! The above document had some coding errors, which are explained below:
Around line 325:
You forgot a '=back' before '=head1'
perl v5.18.2 2009-12-12 Date::Parse(3)