Sponsored Content
Full Discussion: date comparision
Operating Systems Solaris date comparision Post 302142442 by dave_nithis on Friday 26th of October 2007 07:35:29 AM
Old 10-26-2007
Data Compare two dates using shell scripting

a=2007-05-10 (YYYY-DD-MM Format)
b=2007-06-10

These are the two given dates and I need to compare.
(First It should split the dates into YYYY,dd,mm)

The script should first compare years(2007 here).If both are same or if "a" is lesser than "b"(ie.suppose year in "a" is 2006),it should print correct.If "a"(ie. suppose year in a is 2008) is greater than b,then it should print error.Similarly for the dates(05 and 06).

No need to check for the months(10).

Regards,
Dave Nithis.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

date comparision

Hello, I am trying to compare two dates which are in variables and i am not getting the correct result as expected. $first_date = '07/19/2007' $second_date='07/20/2007' Can you please suggest how to i check whether they are equal or not. if ($first_date -eq $second_date) condition is not... (3 Replies)
Discussion started by: kotasateesh
3 Replies

2. Shell Programming and Scripting

while - comparision

Hi, Please find the attached scriplet and suggest me to fix the bug in this. ----------------------------------- noofdirs=`ls *.tar | wc -l` if ; then let i=1 while ( $i <= $noofdirs ) ; do echo $i mkdir $i file1=`ls *.tar | head -1` mv $file1 $i i =... (2 Replies)
Discussion started by: sharif
2 Replies

3. Shell Programming and Scripting

Date Comparision in the File

Hi All, I have thefollowing files in the directory inbox/sat ras.sat.trn.20090103.001902.00004358 ras.sat.trn.20090612.001903.00005339 ras.sat.trn.20090723.001902.00004358 The above file contains the date of the file creation. We just need to write a ksh shell script to check the... (5 Replies)
Discussion started by: satheesh_color
5 Replies

4. Shell Programming and Scripting

Problem with Date Comparision

Hi, I have a file which has the date in the last line in the example pasted along with the rates of the countries. -- I want to compare the date in the last line of the file mentioned in the example below with the system date from Monday to Friday. -- If system date is equal to the date... (2 Replies)
Discussion started by: Raji_gadam
2 Replies

5. Shell Programming and Scripting

problem in date comparision

#!/bin/ksh var="2009-08-31 12:39:05 UTC" ddate=`echo $var|cut -d' ' -f1` y1=`echo $ddate|cut -d'-' -f1` m1=`echo $ddate|cut -d'-' -f2` d1=`echo $ddate|cut -d'-' -f3` filedate=$y1$m1$d1 currdate="20070814" if ]; then echo "$LINE -> $filedate LOWER THAN $currdate" ... (0 Replies)
Discussion started by: HemaV
0 Replies

6. Programming

Problem with date comparision in Pro*C

Hi, I have written the following Pro*C program to get the difference between 2 dates.But when I am printing the value of the date difference,it is always showing 0. #include<stdio.h> #include<sqlca.h> #include<oraca.h> void main() { EXEC SQL BEGIN DECLARE SECTION; int diff; ... (4 Replies)
Discussion started by: sureshbabuc
4 Replies

7. Shell Programming and Scripting

Date - String comparision

Hi, I am having difficulty to compare a string in a file against a date from a a table and print the latest date. Below are the values. String in File : 2009-12-02 00:37:51 Value Table : 2010-01-10-02.00.49.294758 I have to compare both the values ( Ignore the Microsecond in the table... (5 Replies)
Discussion started by: sam_78_nyc
5 Replies

8. Shell Programming and Scripting

Date Manipulation and Comparision

Hi All, I want to generate quarter dates using awk or anything, by giving a dates as input for example : start_date=2010-01-01 end_date=2010-05-31 output should be: start_date end_date qtr 2010-01-01 2010-03-31 1 2010-04-01 2010-05-31 2 Example 2:... (1 Reply)
Discussion started by: sol_nov
1 Replies

9. Shell Programming and Scripting

Date comparision in Unix

Hi All, I would need your help to compare dates in my script. Say if I have the dates in a file I need to comapre these dates with yesterday's date and the dates which are older than yesterday needs to be displayed. Example: 03/22/2012 03/24/2012 03/20/2012 03/21/2012 03/12/2012... (1 Reply)
Discussion started by: pdreddy34
1 Replies

10. Shell Programming and Scripting

Date command comparision with a different format

I have a script called " passwd_status " which gives the passwd-s status of my servers. the script output is like below password status for A: abc ks 10/05/115 1 30 ps password status for B: abc ks 09/25/115 1 30 ps password status for C: abc ks 10/10/115 1 30 ps Now , i want to... (1 Reply)
Discussion started by: charanarjun
1 Replies
Oxford::Calendar(3pm)					User Contributed Perl Documentation				     Oxford::Calendar(3pm)

NAME
Oxford::Calendar - University of Oxford calendar conversion routines SYNOPSIS
use 5.10.0; use Oxford::Calendar; use Date::Calc; say "Today is " . Oxford::Calendar::ToOx(reverse Date::Calc::Today); DESCRIPTION
This module converts University of Oxford dates (Oxford academic dates) to and from Real World dates, and provides information on Terms of the University. The Terms of the University are defined by the Regulations on the number and lengths of terms, available online from http://www.admin.ox.ac.uk/examregs/03-00_REGULATIONS_ON_THE_NUMBER_AND_LENGTH_OF_TERMS.shtml <http://www.admin.ox.ac.uk/examregs/03-00_REGULATIONS_ON_THE_NUMBER_AND_LENGTH_OF_TERMS.shtml> This document describes the start and end dates of Oxford Terms. In addition to this, the dates of Full Term, required to calculate the week number of the term, are prescribed by Council, and published periodically in the University Gazette. Full term comprises weeks 1-8 inclusive, but sometimes, dates outside of full term are presented in the Oxford academic date format. This module will optionally provide such dates. Data for these prescribed dates may be supplied in the file /etc/oxford-calendar.yaml; if this file does not exist, built-in data will be used. The built-in data is periodically updated from the semi-authoritative source at <http://www.ox.ac.uk/about_the_university/university_year/dates_of_term.html>. or the authoritative source, the Gazette, available online from <http://www.ox.ac.uk/gazette/>. <http://www.ox.ac.uk/about_the_university/university_year/index.html> describes the academic year at Oxford. DATE FORMAT
An Oxford academic date has the following format: <day of week>, <week number>[st,nd,rd,th] week, <term name> <year> where term name is one of o Michaelmas (autumn) o Hilary (spring) o Trinity (summer) Example: Friday, 8th Week, Michaelmas 2007 FUNCTIONS
ToOx($day, $month, $year, [\%options]) Given a day, month and year in standard human format (that is, month is 1-12, not 0-11, and year is four digits) will return a string of the form Day, xth week, Term year or an array (Day, week of term, Term, year) depending on how it is called. The exact behaviour is modified by the 'mode' option described below. If the requested date is not in full term or extended term (see below), undef will be returned. If the requested date is not covered by the database, ToOx will die with an "out of range" error message. Therefore it is recommended to eval ToOx with appropriate error handling. %options can contain additional named parameter options: mode Several modes are available: full_term Term dates will only be returned if the date requested is part of a full term (as defined by the web page above). ext_term Term dates will only be returned if the date requested is part of an extended term, or statutory term. nearest Will return term dates based on the nearest term, even if the date requested is not part of an extended term (i.e. will include fictional week numbers). This is currently the default behaviour, for backwards compatibility with previous releases; this may be changed in future. confirmed If true, ignores dates marked as provisional in the database. ThisTerm($year, $month, $day) Given a year, month, term in standard human format (that is, month is 1-12, not 0-11, and year is four digits) will returns the current term or undef if in vacation or unknown. The term is given as an array in the form (year, term). NextTerm($year, $month, $day) Given a day, month and year in standard human format (that is, month is 1-12, not 0-11, and year is four digits) will return the next term (whether or not the date given is in term time). The term is given as an array in the form (year, term). StatutoryTermDates($year) Returns a hash reference keyed on terms for a given year, the value of each being a hash reference containing start and end dates for that term. The dates are stored as array references containing numeric year, month, day values. Note: these are the statutory term dates, not full term dates. Parse($string) Takes a free-form description of an Oxford calendar date, and attempts to divine the expected meaning. If the name of a term is not found, the current term will be assumed. If the description is unparsable, undef is returned. Otherwise, an array will be returned of the form "($year,$term,$week,$day)". This function is experimental. FromOx($year, $term, $week, $day) Converts an Oxford date into a Gregorian date, returning a string of the form "DD/MM/YYYY" or undef. The arguments are of the same format as returned by ToOx in array context; that is, a four-digit year, the name of the term, the week number, and the name of the day of week (e.g. 'Sunday'). If the requested date is not covered by the database, FromOx will die with an "out of range" error message. Therefore it is recommended to eval ToOx with appropriate error handling. BUGS
Bugs may be browsed and submitted at http://rt.cpan.org/Public/Dist/Display.html?Name=Oxford-Calendar <http://rt.cpan.org/Public/Dist/Display.html?Name=Oxford-Calendar> A copy of the maintainer's git repository may be found at https://github.com/jmdh/Oxford-Calendar <https://github.com/jmdh/Oxford-Calendar> AUTHOR
Simon Cozens is the original author of this module. Eugene van der Pijll, "pijll@cpan.org" took over maintenance from Simon for a time. Dominic Hargreaves currently maintains this module for the Computing Services, University of Oxford. perl v5.14.2 2012-06-26 Oxford::Calendar(3pm)
All times are GMT -4. The time now is 08:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy