getdate.3c (2010 09)
g
getdate(3C) getdate(3C)
The field descriptors %c, %x
, and %X are not supported if they include unsupported field descriptors.
The following example shows the possible contents of a template:
%m
%A %B %d, %Y, %H:%M:%S
%A
%B
%m/%d/%y %I %p
%d,%m,%Y %H:%M
at %A the %dst of %B in %Y
run job at %I %p, %B %dnd
%A den %d. %B %Y %H.%M Uhr
The following are examples of valid input specifications for the above template:
getdate("10/1/87 4 PM");
getdate("Friday");
getdate("Friday September 18, 1987, 10:30:30");
getdate("24,9,1986 10:30");
getdate("at monday the 1st of december in 1986");
getdate("run job at 3 PM, december 2nd");
If the LC_TIME category is set to a German locale that includes freitag as a weekday name and
oktober as a month name, the following would be valid:
getdate("freitag den 10. oktober 1986 10.30 Uhr");
This example shows how local date and time specification can be defined in the template:
Invocation Line in Template
getdate("11/27/86") %m/%d/%y
getdate("27.11.86") %d.%m.%y
getdate("86-11-27") %y-%m-%d
getdate("Friday 12:00:00") %A %H:%M:%S
The following rules apply when converting the input specification into the internal format:
• If only the weekday is given, today is assumed if the given day is equal to the current day, and
next week if it is less.
• If only the month is given, the current month is assumed if the given month is equal to the
current month, and next year if it is less and no year is given (the first day of the month is
assumed if no day is given).
• If no hour, minute and second are given, the current hour, minute and second are assumed.
• If no date is given, today is assumed if the given hour is greater than the current hour and
tomorrow is assumed if it is less.
The following examples help to illustrate the above rules assuming that the current date is
Mon Sep 22
12:19:47 EDT 1986, and the LC_TIME category is set to the default C locale.
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010