If you have the perl with Date::Calc module, then you can use Mktime to calculate the epoch. Then subtract the both epoch and divide it by 60 (seconds) to find the minutes.
I need to figure out the numeric representation of the previous month (in an automated monthly-running script) so that I may append it to a filename. I have tried statements such as variable=`date +%m -1` (and several variations) but with no success. I have also tried simply assigning the value... (3 Replies)
hi gurus!
i realize that my question shows my stupidness, but i need your help!
i have:
s_date=`date +%m-%d-%Y_%I%p`
variable and i need the same, but minus one hour..
what i made:
s_date=time(`date +%m-%d-%Y_%I%p`) - 3600
but i'm getting:
daily_exports.sh: line 20: syntax error near... (4 Replies)
Hi all,
I need the date subtraction fuctionality using shell commands.
For example:
date1:Wed Apr 5 08:35:21 IST 2006
date2:Tue Apr 4 10:35:44 IST 2006
I need the date subtraction result like " 22 hours 23 seconds".
Please guide me to complete this task.
Can you please help me ASAP.
... (3 Replies)
hi,
i set up a script on my server to do a particular task once files from an external system are ftpd in the format compaq_20100110 (YYDDMM). Interestingly, the source of ftp is sending the files in the format e.g 20100109 i.e. previous date and for some reason this fails.kindly see my script... (2 Replies)
Hallo all i am trying to execute this script ...............
But this is throwing the error......
use of uninitialized value in subtraction in at icd_convert.pl line 156
use of uninitialized value in subtraction in at icd_convert.pl line 157
use of uninitialized value in subtraction in at... (1 Reply)
HI gurus...
I have a PERL file that help me extract the date and time
of the file.
The format of this is: yyyymmddhhmmss.
Example:
20100430070935 (April 30 2010 07:09:35)
How can i subtract the acquired time from system's time..??
The answer... (6 Replies)
Hi
#!/bin/sh
month=`date +%m`
year=`date +%Y`
echo $month
a=02
# Retaining Data for Current and Previous Month
lmonth=`expr $month - $a`
if test "$lmonth" = "0"
then
lmonth=12
year=`expr $year - 1`
fi
echo $year
echo $lmonth
The output is (3 Replies)
Hello all .
I have two arrays.
${ARRAY_MOUNT_POINT_CAPACITY}
${ARRAY_MOUNT_POINT_CAPACITY}.
Whats the synatx of subtracting their values , placing them in variable V1 and then echoeing it ???
Ive tried expr and let ...gives me ./test_code.sh: difference: bad number (3 Replies)
Hello All,
I am a newbie to unix shell scripting and need to write a script that displays the difference between two variables that stores date value.
For example,
F1=`ls -ltr file1* | tail -1 |tr -s ' ' |cut -d' ' -f6,7,8`
F2=`ls -ltr file2* | tail -1 |tr -s ' ' |cut -d' ' -f6,7,8`
F1... (3 Replies)
Discussion started by: priyaa2010
3 Replies
LEARN ABOUT CENTOS
cal
CAL(1) User Commands CAL(1)NAME
cal - display a calendar
SYNOPSIS
cal [options] [[[day] month] year]
DESCRIPTION
cal displays a simple calendar. If no arguments are specified, the current month is displayed.
OPTIONS -1, --one
Display single month output. (This is the default.)
-3, --three
Display prev/current/next month output.
-s, --sunday
Display Sunday as the first day of the week.
-m, --monday
Display Monday as the first day of the week.
-j, --julian
Display Julian dates (days one-based, numbered from January 1).
-y, --year
Display a calendar for the current year.
-V, --version
Display version information and exit.
-h, --help
Display help screen and exit.
PARAMETERS
A single parameter specifies the year (1 - 9999) to be displayed; note the year must be fully specified: cal 89 will not display a calendar
for 1989.
Two parameters denote the month (1 - 12) and year.
Three parameters denote the day (1-31), month and year, and the day will be highlighted if the calendar is displayed on a terminal. If no
parameters are specified, the current month's calendar is displayed.
A year starts on Jan 1. The first day of the week is determined by the locale.
The Gregorian Reformation is assumed to have occurred in 1752 on the 3rd of September. By this time, most countries had recognized the ref-
ormation (although a few did not recognize it until the early 1900's). Ten days following that date were eliminated by the reformation, so
the calendar for that month is a bit unusual.
HISTORY
A cal command appeared in Version 6 AT&T UNIX.
AVAILABILITY
The cal command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
util-linux June 2011 CAL(1)