i done some modifications for considering holidays also(i.e local holiday).
also you can get nth working day from given day.
if holiday list is stored in table, you can build hash table on it instead of array of holiday. hash table will give lots of performance gain also
Hi ,
I am relatively new to unix...
Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell..
This is very urgent.
Thanks for ur help... (7 Replies)
Hello guys it´s a pleasure to type with the unix community...I´m new in shell script and I need to insert into a #!/ksh a statment that will check if a file that I´ll receive from another script is arriving in the first working day of each month:
let´s say that I´ll reveive the following files... (1 Reply)
Hi
I need a script to get "Last working day of the month". I will pass the month and year as parameters and i need to get the last working date.
Ex
for June 2008 the last working day is 30th its monday.
for August 2008 the last working day is 29th and it is Friday.
ie the last working... (6 Replies)
Hi,
I want a script(ksh) to see if today is the last working day(Mon-Fri) of the month. If it is the last working day I need to print current date, else I need the last working day of previous month. Thanks in advance. (1 Reply)
Hi All,
I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this.
My Requirment is as below:
Input for me will be 2000909(YYYYMM)
I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Hi,
How to find the first working day of month ?
My requirement is, I need to call the function only if today is first working day of month. I could find out one function which finds last working day in month in this forum. Can anyone pls let me know for first working day. Thanks.
for... (10 Replies)
I have a business requirement in my project where I need to calculate the 12th working day of every month. Can any please tell me the solution to my problem.
Thanks in advance (7 Replies)
Hello Guys,
I have a questions regarding running a shell script every second working day each month.
I have no clue how solve this problem :wall:.
Important is that it has to be the second working (Mo-Fr).
Example: If 1st and 2nd Days of month are Sat and Sun the script must run on 4th day... (5 Replies)
Hi,
I would like to calculate 1st working/Business day of each month.
Exp:
1st -Oct-2011 is Saturday--- Non Business Day
So the Next Working Day would be 3-Oct-2011
I need a shell script to calculate the month first business date. (3 Replies)
I am unable to get this KSH script to work. Can someone help. I've been told this should work with KSH93. Which I think I have on Solaris 10.
If I do a grep -i version /usr/dt/bin/dtksh I get
@(#)Version M-12/28/93d
@(#)Version 12/28/93
@(#)Version M-12/28/93
This is correct for... (5 Replies)
Discussion started by: thibodc
5 Replies
LEARN ABOUT DEBIAN
print_time_table
PARSE_TIME(3) BSD Library Functions Manual PARSE_TIME(3)NAME
parse_time, print_time_table, unparse_time, unparse_time_approx, -- parse and unparse time intervals
LIBRARY
The roken library (libroken, -lroken)
SYNOPSIS
#include <parse_time.h>
int
parse_time(const char *timespec, const char *def_unit);
void
print_time_table(FILE *f);
size_t
unparse_time(int seconds, char *buf, size_t len);
size_t
unparse_time_approx(int seconds, char *buf, size_t len);
DESCRIPTION
The parse_time() function converts a the period of time specified in into a number of seconds. The timespec can be any number of <number
unit> pairs separated by comma and whitespace. The number can be negative. Number without explicit units are taken as being def_unit.
The unparse_time() and unparse_time_approx() does the opposite of parse_time(), that is they take a number of seconds and express that as
human readable string. unparse_time produces an exact time, while unparse_time_approx restricts the result to only include one units.
print_time_table() prints a descriptive list of available units on the passed file descriptor.
The possible units include:
second, s
minute, m
hour, h
day
week seven days
month 30 days
year 365 days
Units names can be arbitrarily abbreviated (as long as they are unique).
RETURN VALUES
parse_time() returns the number of seconds that represents the expression in timespec or -1 on error. unparse_time() and
unparse_time_approx() return the number of characters written to buf. if the return value is greater than or equal to the len argument, the
string was too short and some of the printed characters were discarded.
EXAMPLES
#include <stdio.h>
#include <parse_time.h>
int
main(int argc, char **argv)
{
int i;
int result;
char buf[128];
print_time_table(stdout);
for (i = 1; i < argc; i++) {
result = parse_time(argv[i], "second");
if(result == -1) {
fprintf(stderr, "%s: parse error
", argv[i]);
continue;
}
printf("--
");
printf("parse_time = %d
", result);
unparse_time(result, buf, sizeof(buf));
printf("unparse_time = %s
", buf);
unparse_time_approx(result, buf, sizeof(buf));
printf("unparse_time_approx = %s
", buf);
}
return 0;
}
$ ./a.out "1 minute 30 seconds" "90 s" "1 y -1 s"
1 year = 365 days
1 month = 30 days
1 week = 7 days
1 day = 24 hours
1 hour = 60 minutes
1 minute = 60 seconds
1 second
--
parse_time = 90
unparse_time = 1 minute 30 seconds
unparse_time_approx = 1 minute
--
parse_time = 90
unparse_time = 1 minute 30 seconds
unparse_time_approx = 1 minute
--
parse_time = 31535999
unparse_time = 12 months 4 days 23 hours 59 minutes 59 seconds
unparse_time_approx = 12 months
BUGS
Since parse_time() returns -1 on error there is no way to parse "minus one second". Currently "s" at the end of units is ignored. This is a
hack for English plural forms. If these functions are ever localised, this scheme will have to change.
HEIMDAL October 31, 2004 HEIMDAL