Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need help regarding date calculation Post 302920997 by rbatte1 on Tuesday 14th of October 2014 06:13:45 AM
Old 10-14-2014
Hello abhi_123,

I have a few to questions pose in response first:-
  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using? Different ones have different tools.
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly, What have you tried so far?

I think you are wanting the get the previous working day ignoring Saturday & Sunday, but what about company or national holidays? Would there need to be a list to consider stepping and extra day or two too?


There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.


We're all here to learn and getting the relevant information will help us all.


Kind regards,
Robin
 

10 More Discussions You Might Find Interesting

1. Programming

date calculation program

Hi One of my vendor based tool is giving date in no. of days since 1900-01-01. So, I want to display in CCYYMMDD format. For ex:- Vendor based tool is giving as 38790 days since 1900-01-01 corresponding to12/sep/2006 Does anybody has the... (1 Reply)
Discussion started by: axes
1 Replies

2. Shell Programming and Scripting

Date Calculation

Hi experts, Can you please help me in calculating the future date using unix shell scripting.. for example lets say todays date is 29-sep-2008 i wanna calculate the date after 365 days... hence the date must be 29-sep-2009.. Quick response is appreciable. thanks in... (2 Replies)
Discussion started by: subhendu81
2 Replies

3. UNIX for Advanced & Expert Users

date calculation scripts(hp-ux)

Hi all, i need a script that can check if users did an operation within 3 days,if not delete all the logs of users who did not perform any activity after 3 days.therefore script should be able to use current date and verify last date user performed activity and see if it is greater or less than 3... (3 Replies)
Discussion started by: tomjones
3 Replies

4. Shell Programming and Scripting

Problems with date calculation

Hello all. I'm writing a script that should work with some files being sure that them were created a concrete day (0, 1, 2 or 3 days before script execution). This task should be done under Solaris and Linux hosts with different versions (Solaris 8, 9 and 10, Suse 9 and 10) so I'm trying to make... (3 Replies)
Discussion started by: nefeli
3 Replies

5. Shell Programming and Scripting

Date time calculation

hello guys, I had been to many forums and many topics in this site as well for my question but did not get any solution. My question is how i can get y'day date with time stamp today is 20100729103819 and i am looking for output as 20100728103819. in simple words as we do in oracle sysdate-1... (4 Replies)
Discussion started by: lokaish23
4 Replies

6. Shell Programming and Scripting

Date calculation script

hello! I need a date calculation script that need to do that: ./date.sh 20090312 and the script need to give me which day is it for example monday friday or what else! can anyone help me?? its really urgent :S thx the help! (7 Replies)
Discussion started by: impish
7 Replies

7. Shell Programming and Scripting

Date calculation

I have to run a shell , only if file_a.txt is updated correctly before 1hr. that is, file_a.txt 2011_09_21__14:10:20 --> any format.. And the shell can be like, if ; then Run some shell update file_a.txt with (date now) fi how to do this ? (6 Replies)
Discussion started by: linuxadmin
6 Replies

8. Shell Programming and Scripting

Date calculation, a little different...

Hello eveyone, I am tasked to write an (n)awk script to calculate the days between dates. Now before anyone chastizes me on how many forums there are on date calculation, I have no seen one that takes into account the Julian calender as well. As most know, September of 1752 is when we (the US)... (2 Replies)
Discussion started by: csharp100
2 Replies

9. Shell Programming and Scripting

Date calculation

Hi I have this date 11:30:02-31.11.12 How to calculate date between this date and now? I like it printed like this: 31D 2H 1M if possible. (6 Replies)
Discussion started by: Jotne
6 Replies

10. UNIX for Dummies Questions & Answers

Date calculation in UNIX

I want to automate change in 'from yyyy/mm/dd to yyyy/mm/dd' every month in a unix program. For example in this month 'from yyyy/mm/dd to yyyy/mm/dd' is 'from 2014/10/01 to 2014/11/01' next month it should be 'from 2014/11/01 to 2014/12/01' Can any one provide me the code for the above... (2 Replies)
Discussion started by: srinivas kasett
2 Replies
CALENDAR(1)						    BSD General Commands Manual 					       CALENDAR(1)

NAME
calendar -- reminder service SYNOPSIS
calendar [-a] [-A num] [-B num] [-F friday] [-f calendarfile] [-t dd[.mm[.year]]] [-W num] DESCRIPTION
The calendar utility checks the current directory for a file named calendar and displays lines that begin with either today's date or tomor- row's. On the day before a weekend (normally Friday), events for the next three days are displayed. The following options are available: -A num Print lines from today and the next num days (forward, future). -a Process the ``calendar'' files of all users and mail the results to them. This requires super-user privileges. -B num Print lines from today and the previous num days (backward, past). -F friday Specify which day of the week is ``Friday'' (the day before the weekend begins). Default is 5. -f calendarfile Use calendarfile as the default calendar file. -t dd[.mm[.year]] For test purposes only: set date directly to argument values. -W num Print lines from today and the next num days (forward, future). Ignore weekends when calculating the number of days. To handle calendars in your national code table you can specify ``LANG=<locale_name>'' in the calendar file as early as possible. To handle national Easter names in the calendars ``Easter=<national_name>'' (for Catholic Easter) or ``Paskha=<national_name>'' (for Orthodox Easter) can be used. Other lines should begin with a month and day. They may be entered in almost any format, either numeric or as character strings. If the proper locale is set, national month and weekday names can be used. A single asterisk (``*'') matches every month. A day without a month matches that day of every week. A month without a day matches the first of that month. Two numbers default to the month followed by the day. Lines with leading tabs default to the last entered date, allowing multiple line specifications for a single date. ``Easter'', is Easter for this year, and may be followed by a positive or negative integer. ``Paskha'', is Orthodox Easter for this year, and may be followed by a positive or negative integer. Weekdays may be followed by ``-4'' ... ``+5'' (aliases for last, first, second, third, fourth) for moving events like ``the last Monday in April''. By convention, dates followed by an asterisk are not fixed, i.e., change from year to year. Day descriptions start after the first <tab> character in the line; if the line does not contain a <tab> character, it is not displayed. If the first character in the line is a <tab> character, it is treated as a continuation of the previous line. The ``calendar'' file is preprocessed by cpp(1), allowing the inclusion of shared files such as lists of company holidays or meetings. If the shared file is not referenced by a full pathname, cpp(1) searches in the current (or home) directory first, and then in the directory /usr/share/calendar. Empty lines and lines protected by the C commenting syntax (/* ... */) are ignored. Some possible calendar entries (<tab> characters highlighted by sequence) LANG=C Easter=Ostern #include <calendar.usholiday> #include <calendar.birthday> 6/15 June 15 (if ambiguous, will default to month/day). Jun. 15 June 15. 15 June June 15. Thursday Every Thursday. June Every June 1st. 15 * 15th of every month. May Sun+2 second Sunday in May (Muttertag) 04/SunLast last Sunday in April, summer time in Europe Easter Easter Ostern-2 Good Friday (2 days before Easter) Paskha Orthodox Easter FILES
calendar file in current directory ~/.calendar calendar HOME directory. A chdir is done into this directory if it exists. ~/.calendar/calendar calendar file to use if no calendar file exists in the current directory. ~/.calendar/nomail do not send mail if this file exists. The following default calendar files are provided: calendar.all File which includes all the default files. calendar.australia Calendar of events in Australia. calendar.birthday Births and deaths of famous (and not-so-famous) people. calendar.christian Christian holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. calendar.computer Days of special significance to computer people. calendar.croatian Calendar of events in Croatia. calendar.freebsd Birthdays of FreeBSD committers. calendar.french Calendar of events in France. calendar.german Calendar of events in Germany. calendar.history Everything else, mostly U.S. historical events. calendar.holiday Other holidays, including the not-well-known, obscure, and really obscure. calendar.judaic Jewish holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. calendar.music Musical events, births, and deaths. Strongly oriented toward rock 'n' roll. calendar.newzealand Calendar of events in New Zealand. calendar.russian Russian calendar. calendar.southafrica Calendar of events in South Africa. calendar.usholiday U.S. holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. calendar.world Includes all calendar files except for national files. COMPATIBILITY
The calendar program previously selected lines which had the correct date anywhere in the line. This is no longer true, the date is only recognized when it occurs at the beginning of a line. SEE ALSO
at(1), cpp(1), mail(1), cron(8) HISTORY
A calendar command appeared in Version 7 AT&T UNIX. BUGS
The calendar utility does not handle Jewish holidays and moon phases. BSD
June 13, 2002 BSD
All times are GMT -4. The time now is 01:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy