datecalc

Run the datecalc utility on a master domain manager or a fault-tolerant agent workstation (not supported on dynamic agents) to resolve date expressions and return dates in the format you choose.

Syntax

datecalc -V | -U

datecalc base-date
     [offset]
     [pic format]
     [freedays Calendar_Name [-sa] [-su]]

datecalc -t time
     [base-date]
     [offset]
     [pic format]

datecalc yyyymmddhhtt
     [offset]
     [pic format]

Arguments

-V
Displays the command version and exits.
-U
Displays command usage information and exits.
base-date

Specify one of the following:

day | date | today | tomorrow | scheddate

where:

day
Specifies a day of the week. Valid values are: su, mo, tu, we, th, fr, or sa.
date
Specifies a date, in the format element/element[/element], where element is: d[d], m[m], and yy[yy]. Any different format of date is not valid.

If two digits are used for the year (yy), a number greater than 70 is a 20th century date, and a number less than 70 is a 21st century date.

The parameter refers to the actual date, not to the UNIX date command. The following example shows an option to use the output of the UNIX date as input for HCL Workload Automation date parameter.

hdate=´date +"%m/%d/%y"´
echo $hdate
datecalc $hdate pic mm/dd/yyyy

Valid values for the month (m[m]) are jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, or dec.

The slashes (/) can be replaced by dashes (-), periods (.), commas (,), or spaces. For example, any of the following can be entered for March 28, 2005:

03/28/05
3-28-2005
28.mar.05
05,28,3
mar 28 2005
28 3 05

If numbers are used, it is possible to enter an ambiguous date, for example, 2,7,04. In this case, datecalc uses the date format defined in the HCL Workload Automation message catalog to interpret the date. If the date does not match the format, datecalc generates an error message.

today
Specifies the current system date.
tomorrow
Specifies the current system date plus one day, or, in the case of time calculations, plus 24 hours.
scheddate
Specifies the date of the production plan. This might not be the same as the system date. When used inside jobs within a job stream that is not a carried forward job stream, it returns the date when the job should run, which could be different from the production date of the job stream if the job has an at dependency specified.

When used inside jobs within a carried forward job stream, it returns the date when the job should have run, which could be different from the production date of the carried forward job stream if the job has an at dependency specified. If the at dependency is used with the following syntax: at=hhmm + n days, the n days are not added to the variable TIVOLI_JOB_DATE and therefore, the datecalc command does not report these days.

For example, consider a plan for the day 15/01/2015 with a start of day set at 0700, and this schedule
SCHEDULE NET92A#JS0200CF                                        
ON RUNCYCLE RULE1 "FREQ=DAILY;"                                 
AT 0200                                                         
:                                                               
NET92A#DATECALC                                                 
END                    
If the job runs at 0200, datecalc returns the time 0200 of the day 16/01/2015. If the schedule is carried forward, and the job runs at 1000, the reported result for datecalc is the time 1000 of the day 15/01/2015.
-t time [base-date]
Specify time in one of the following formats:

now | noon | midnight | [h[h][[:]mm] [am | pm] [zulu]

where:
now
Specifies the current system date and time.
noon
Specifies 12:00 p.m. (or 1200).
midnight
Specifies 12:00 a.m. (or 0000).
h[h][[:]mm]
Specifies the hour and minute in 12-hour time (if am or pm are used), or 24-hour time. The optional colon (:) delimiter can be replaced by a period (.), a comma (,), an apostrophe ('), the letter h, or a space. For example, any of the following can be entered for 8:00 p.m.:

8:00pm
20:00
0800pm
2000
8pm  
20
8,00pm
20.00
8\'00pm
20 00

zulu
Specifies that the time you entered is Greenwich Mean Time (Universal Coordinated Time). datecalc converts it to the local time.
yyyymmddhhtt
Specifies the year, month, day, hour, and minute expressed in exactly twelve digits. For example, for 2005, May 7, 9:15 a.m., enter the following: 200505070915
offset
Specifies an offset from base-date in the following format:

{[+ | | - | number | nearest] | next} day[s] | weekday[s] |
workday[s] | week[s] | month[s] | year[s] | hour[s] | minute[s] |
day | calendar

where:
+ | >
Specifies an offset to a later date or time. Use + (Plus) in Windows®; use > (greater than) in UNIX®. Be sure to add a backslash (\) before the angle bracket (>).
- |
Specifies an offset to an earlier date or time. Use - (Minus) in Windows®; use < (less than) in UNIX®. Be sure to add a backslash (\) before the angle bracket (>).
number
The number of units of the specified type.
nearest
Specifies an offset to the nearest occurrence of the unit type (earlier or later).
next
Specifies the next occurrence of the unit type.
day[s]
Specifies every day.
weekday[s]
Specifies every day except Saturday and Sunday.
workday[s]
Same as weekday[s], but also excludes the dates on the holidays calendar.
week[s]
Specifies seven days.
month[s]
Specifies calendar months.
year[s]
Specifies calendar years.
hour[s]
Specifies clock hours.
minute[s]
Specifies clock minutes.
day
Specifies a day of the week. Valid values are: su, mo, tu, we, th, fr, or sa.
calendar
Specifies the entries in a calendar with this name.
pic format
Specifies the format in which the date and time are returned. The format characters are as follows:
m
Month number.
d
Day number.
y
Year number.
j
Julian day number.
h
Hour number.
t
Minute number.
^|/
One space. Use / (slash) in Windows®; use ^ (carat) in UNIX® (add a backslash (\) before the carat (^) if you are in the Bourne shell).

You can also include punctuation characters. These are the same as the delimiters used in date and time.

If a format is not defined, datecalc returns the date and time in the format defined by the Native Language Support (NLS) environment variables. If the NLS variables are not defined, the native language defaults to C.

freedays
Specifies the name of a non-working days calendar Calendar_Name that is to replace holidays in the evaluation of workdays.

In this case, workdays is evaluated as everyday excluding saturday, sunday, and all the dates listed in Calendar_Name.

By default, saturday and sunday are not regarded as workdays, unless you explicitly state the opposite by adding -sa and -su after Calendar_Name.

You can also specify holidays as the name of the non-working days calendar.

Examples

To return the next date, from today, on the monthend calendar, run the following command:

datecalc today next monthend
In the following examples, the current system date is Friday, April 16, 2006.
datecalc today +2 days pic mm/dd/yyyy
04/16/2006
datecalc today next tu pic yyyy\^mm\^dd
2006 04 16
LANG=american;export LANG 
>datecalc -t 14:30 tomorrow
Sat, Apr 17, 2006 02:30:00 PM
LANG=french;datecalc -t 14:30 tomorrow
Samedi 17 avril 2006 14:30:00
In the following example, the current system time is 10:24.
datecalc -t now \> 4 hours pic hh:tt
14:24