07-29-2011
Comparing dates
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.One more condition is change of year also i.e today is Jan1 2012 and yesterday is Dec 31 2011.
The above rek i want in Shell script(KSH)...
Can any one please help me?
Last edited by radoulov; 07-29-2011 at 05:42 PM..
Reason: Title fixed.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI,
I am able to find days difference using FIND command. However it is comparing between today and the last time it was modified.
I now need to find the difference between a date specified by myself and the last time the file was modified. Is there a command which I can use or I have to... (1 Reply)
Discussion started by: scmay
1 Replies
2. Shell Programming and Scripting
hi ,
I have two variables both containg dates,
x= `date`
and
y= `date'
their format being -> Fri Nov 12 22:59:50 MST 2004
how do I compare which one is greater.
->Can dates be converted into integer and then compared?
( one lengthy way would be to compare the words one by... (7 Replies)
Discussion started by: k_oops9
7 Replies
3. Programming
hi
is there a c function in linux for comparing dates.
thanx in advance.
svh (2 Replies)
Discussion started by: svh
2 Replies
4. Shell Programming and Scripting
Hi All.
Can someone please give me an example of how I'd do a comparison to find out if the last modified date of a file is newer than yesterday (i.e. today - 1 day)?
Example:
if ; then
echo "Do something..."
fi
Any ideas or examples?
Thanks. (1 Reply)
Discussion started by: dmilks
1 Replies
5. Shell Programming and Scripting
Hi,
Can some one guide me how to compare two dates in unix.
TIA
Gupta (5 Replies)
Discussion started by: guptan
5 Replies
6. Shell Programming and Scripting
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 (17 Replies)
Discussion started by: ragha81
17 Replies
7. UNIX for Dummies Questions & Answers
Hi I have yesterday date and todays date stored in two variables.
Today date is stored in variable -- testdate=`date +%m/%d/%Y`
I found the yesterday date and stored in variable -- ydate=$month'/'$day1'/'$year
Now i am trying to find out whether $testdate is less that $ydate.
I am... (6 Replies)
Discussion started by: intiraju
6 Replies
8. Shell Programming and Scripting
Hi
I'm trying to compare the current date (dd-Mmm-yyyy) against a variable that is an extracted date from an sql script. Below is the code:
datenow=`date '+%d-%h-%Y'`
#datenow is the current date in the format dd-Mmm-yyyy
sqlplus $dbuserid/$dbpassword @ $SCRIPT_PATH/business-date.sql >... (3 Replies)
Discussion started by: joyAV
3 Replies
9. UNIX for Dummies Questions & Answers
Hi,
can we do date comparisons in unix? like if i give the two dates find which date is old one and which is new one and difference between the two dates in terms of hours,minutes,days and months. (1 Reply)
Discussion started by: vmachava
1 Replies
10. Shell Programming and Scripting
Hi
I am failing to write a script which compares a list of dates in a file with today's date.
OS: Solaris 10
I have a file which has server names & dates, i need to compare the date in this file with today's date, if it is less than today it should print the server name.
code i tried is ... (3 Replies)
Discussion started by: nanz143
3 Replies
LEARN ABOUT CENTOS
accounting
ACCOUNTING(1) SMPPPD ACCOUNTING(1)
NAME
accounting - calculates statistics about your internet connections
DESCRIPTION
accounting is a simple program to calculate statistics about your internet dial-up connections that are started and stopped by either ifup
and ifdown or by a frontend to smpppd like cinternet , qinternet or kinternet.
OPTIONS
These options are recognized by accounting. If a long option shows an argument as mandatory, then it is mandatory for the equivalent short
option also.
-l, --last=NUM
Only consider the last NUM connections.
-a, --after=DATE
Only consider connections started after DATE. DATE is a date with optional time in ISO 8601 format, e.g. `2002-12-24 20:15:00'.
Note that a date without time is treated as if the time is 00:00:00. Hence connections started on the specified date are consid-
ered.
-b, --before=DATE
Only consider connections started before DATE.
-u, --user=USER
Only consider connections started by user USER.
--this-year
Only consider connections started this year.
--last-year
Only consider connections started last year.
--this-month
Only consider connections started this month.
--last-month
Only consider connections started last month.
--this-week
Only consider connections started this week.
--last-week
Only consider connections started last week.
--today
Only consider connections started today.
--yesterday
Only consider connections started yesterday.
--per-year
Show summaries on a per year basis.
--per-month
Show summaries on a per month basis.
--per-week
Show summaries on a per week basis.
--per-day
Show summaries on a per day basis.
-c, --connections
Only list the connections but do not show provider statistics.
-p, --providers
Do not list the connections only show the provider statistics.
--connection-format=FORMAT
The names of the columns to print in the connection list. The names must be separated by a comma. Known column names are time,
type, provider, user, status, duration, rx, tx, rxtx, averx, avetx and averxtx. Each name may be appended by a colon and a number
indicating the width for the column, e.g. provider:25. The value will not be truncated if the width is too small.
--provider-format=FORMAT
The names of the columns to print in the provider list equivalent to the --connection-format option. Known column names are
provider, number, duration, rx, tx, rxtx, aveduration, averx, avetx and averxtx.
--local
Display all dates in local time. Also interpret dates on the command line in local time. This is the default.
--utc Display all dates in UTC. Also interpret dates on the command line in UTC.
--script[=STYLE]
Format output for script. Known styles are c and sh.
-f, --file=NAME
Use a different file with accounting information.
--report-errors
Report erros in the accounting file.
--version
Show program version and exit.
--help Show help information and exit.
NOTES
All informations are only obtained through the accounting log. Hence the informations, esp. the data volume, of currently active connec-
tions is not accurate. If you want the know the status of a connection, use ifstatus or a frontend to smpppd like cinternet , qinternet or
kinternet instead.
The user field is empty for connections started by a remote frontend of smpppd.
BUGS
Not yet implemented for ISDN (ippp).
FILES
/var/log/smpppd/accounting.log
File containing accounting information.
SEE ALSO
kinternet, qinternet, cinternet(1), smpppd(8), smpppd-ifcfg(8).
AUTHOR
Arvin Schnell <arvin@suse.de>
SuSE December 2002 ACCOUNTING(1)