man ua_date





NAME


  ua_date - Perform date subtraction and convert date/time formats


SYNOPSIS


  ua_date
       [-options] [date1 [date2]]


DESCRIPTION


  The ua_date command "remembers" some common Digital UNIX date	formats	so
  you do not have to. Because of this, ua_date is often	used in	command
  strings to provide a date for	another	command.

  In addition, ua_date can perform date	subtraction and	delta-time calcula-
  tions	which makes it useful for other	flavors	of UNIX.


ARGUMENTS


  date1
       Date (or	Date.Time) string to convert.  Defaults	as "now".

  date2
       If provided, date2 is subtracted	from date1 to obtain a delta time.

       Date formats can	be specified as:
	 yymmdd.hhmmss
	 yy/mm/dd.hh:mm:ss
	 hh:mm:ss
	 [yy/]mm/dd.hh:mm[:ss]
	 [[[yy]yy]mm]dd[.[hh[mm[ss]]]]
	 yyjjj.hhmmss  (julian)
	 [yy]yyjjj[.[hh[mm[ss]]]]
	 +d.hhmmss     (delta plus)
	 -d.hhmmss     (delta minus)
	 .	       (assumed	now)

       The date	can also be specified in C-time	(seconds since 1970) as
       either dSeconds (decimal) or xSeconds (hex).

       Time is optional	in all formats.	 Date is optional if colons are	used
       to specify the time.  When specifying days in the past, such as '-1',
       if the time is not supplied ua_date assumes midnight is desired.	When
       specifying days in the future, such as '+1', if the time	is not sup-
       plied ua_date assumes the current time.

       Date argument examples (assuming	'now' is 10 September 1997):
	       970910.1215     # 10 September, 12:15pm
	       97/09/10.12:15  #       (same)
	       910.12	       # 10 September, Noon
	       9/10	       # 10 September
	       10	       #       (same)
	       .12:15,	       # today,	       12:15pm
	       -1	       # one day ago
	       +.1	       # one hour from now
	       -.1	       # one hour ago


OPTIONS


  -normal
       "Normal"	(default) display.

  -reset
       Format for Digital UNIX date setting

  -uerf
       Format for Digital uerf display

  -hsz Format for hsz controller 'set this time='

  -scheduler
       Format for Polycenter/Scheduler absolute

  -delta
       Format for Polycenter/Scheduler delta

  -ctime
       C time display (seconds since 1970) in hex and decimal.

  -all Display all formats above

  -seconds
       Display a time in seconds For delta times or subtracted times this
       represents actual seconds.  For a single	time this represents seconds
       since midnight.

  -format [field-descriptor...]
	Display	date-time in specified format, such as:
	   "%m/%d/%Y %H:%M:%S"
	would represent	09/10/1997 12:15:00.

  -verbose
       To display additional debugging information

  -?   To display a terse help message


EXAMPLES


   # ua_date				  # "normal"
    970910.150611   yymmdd.hhmmss : 09/10/1997,	1997.253 time 15:06:11

   # ua_date -f	"%m/%d/%Y %H:%M:%S"	  # specified format
   09/10/1997 15:08:02

   # ua_date -all			  # all	formats
    970910.150614   yymmdd.hhmmss : 09/10/1997,	1997.253 time 15:06:14
   unix	'date':	    09101506.1497
   unix	'uerf':	    10-sep-1997,15:06:14
   hsz set time:    10-Sep-1997:15:06:14
   sched  abs.:	   "10-Sep-1997	15:06:14"
   seconds:	   0
   sched delta:	   "+0000 00:00:00"

   # ua_date 314			  # specified month and	day
	314.150657     mmdd.hhmmss : 03/14/1997, 1997.073 time 15:06:57

   # ua_date 3/14.12:15			  # month, day,	hour minute
	314.121500     mmdd.hhmmss : 03/14/1997, 1997.073 time 12:15:00

   # ua_date +.1			  # one	hour from now
    +0000.010000  +dddd.hhmmss : 09/10/1997, 1997.253 time 16:11:10

   # ua_date -.1			  # one	hour ago
    -0000.010000  -dddd.hhmmss : 09/10/1997, 1997.253 time 14:11:14

   # ua_date +1				  # one	day from now
    +0001.000000  +dddd.hhmmss : 09/11/1997, 1997.254 time 15:11:03

   # ua_date -1				  # one	day ago
    -0001.151106  -dddd.hhmmss : 09/09/1997, 1997.252 time 00:00:00

  Note above going back	a day without specifying time goes back	to midnight
  of the previous day.

   # ua_date -sec +.001818		  # seconds in 18 min 17 sec
   1098

   # ua_date 5/14 4/14			  # subtract two dates
    +0030.000000  +dddd.hhmmss : 10/10/1997, 1997.283 time 15:08:34

   # ua_date 3/14 4/14			  # subtract two dates
    -0030.230000  +dddd.hhmmss : 10/11/1997, 1997.284 time 14:08:22

  Note above that daylight savings time	change occured between the dates so
  an hour less than 31 days is reported.

  All formats for 45 days ago, note that options can be	specified either
  before or after arguments:

   # ua_date -45 -a
    -0045.151818  -dddd.hhmmss : 07/27/1997, 1997.208 time 00:00:00
   unix	'date':	    07270000.0097
   unix	'uerf':	    27-jul-1997,00:00:00
   hsz set time:    27-Jul-1997:00:00:00
   sched  abs.:	   "27-Jul-1997	00:00:00"
   seconds:	   55098
   sched delta:	   "-0045 15:18:18"

   A uerf formatted date:

   # ua_date -u	-45
   27-jul-1997,00:00:00


RESTRICTIONS / NOTES


  ua_date has been tested under	DU v3.2g-v4.0d,	IRIX 6.2-6.5, and Unicos 10
  and Unicos/mk	2.0.

  Note,	UNIX binary time starts	in 1970. The maximum 32bit date	is 0x7fffffff
  or 01/18/2038.  The minimum 32bit date is 0x80000000 or 12/13/1901.  Yes,
  there	may be a "real"	y2k problem in 2038 if everything is 64bit or greater
  by then.

  Suggestions for enhancements or bug reports can be directed to
  dutools@ts.sois.alaska.edu.

  This command utilizes	the cci	command	parser utilized	by non-UNIX operating
  systems instead of the traditional UNIX getopt() parsing. Options have been
  defined to "look like" UNIX style options, but can be	spelled	out or
  generally abbreviated. For example '-n' is the same as '-normal'.  In	some
  cases, like '-seconds', options must be partially or fully spelled out.
  Required option length can be	found by ua_date -? . Because of this multi-
  ple options must be space separated and the hyphen is	part of	the option
  name.


ACKNOWLEDGEMENTS


  Written at the University of Alaska.


RELATED INFORMATION


  Commands: date(1).