man ua_date




NAME

  ua_date - Perform date subtraction and convert date/time formats


SYNOPSIS

  ua_date
         [-options] [date1 [date2]]


DESCRIPTION

  The  ua_date accepts input date(s) in various formats and can format
  output date-times in a defined format.

  In addition, ua_date can perform  date  subtraction  and  delta-time
  calculations which makes it useful for date-time comparisons.


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:
                  yyyymmdd.hhmmss
                    yymmdd.hhmmss
                yyyy-mm-dd.hh:mm:ss
                yyyy/mm/dd.hh:mm:ss
                  yy/mm/dd.hh:mm:ss
                           hh:mm:ss
                     mm/dd.hh:mm
           [[[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 supplied ua_date
         assumes the current time.

         Date argument examples (assuming 'now' is 10 Sep 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 UNIX format for setting date.

  Display a time in seconds.

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

  Dispaly a time in hours.

         For delta times or subtracted times  this  represents  actual
         hours.   For  a  single time this represents hours since mid-
         night.

  Dispaly a time in days.

         For delta times or subtracted times  this  represents  actual
         days.  For a single time this represents days since midnight.

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

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

  Display all formats above

  To display additional debugging information

  To display a terse help message


EXAMPLES

   # ua_date                        # "normal"
    080610.142414 yymmdd.hhmmss 2008-06-10 14:24:14 (2008.162)

   # ua_date -f "%m/%d/%Y %H:%M:%S" # specified format
   06/10/2008 14:24:15

   # ua_date -all                   # all formats
    080610.142427 yymmdd.hhmmss 2008-06-10 14:24:27 (2008.162)
   unix 'date' 061014242008.27
    days>00:00  0.60
   hours>00:00 14.41
   secs.>00:00 51867
   ctime(1970) 0x484eff1b 1213136667

   # ua_date 314                    # specified month and day
     0314.142438   mmdd.hhmmss 2008-03-14 14:24:38 (2008.074)

   # ua_date 3/14.12:15             # month, day, hour minute
     0314.121500   mmdd.hhmmss 2008-03-14 12:15:00 (2008.074)

   # ua_date +.1                    # one hour from now
      0.0417 days : 2008-06-10 15:24:59 (2008.162)

   # ua_date -.1                    # one hour ago
     -0.0417 days : 2008-06-10 13:25:14 (2008.162)

   # ua_date +1                     # one day from now
      1.0000 days : 2008-06-11 14:25:32 (2008.163)

   # ua_date -1                     # one day ago
     -1.6011 days : 2008-06-09 00:00:00 (2008.161)

  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
      30.0000 days : 2008-05-14 14:26:12 (2008.135)

   # ua_date 3/14 4/14              # subtract two dates
     -31.0000 days : 2008-03-14 14:26:29 (2008.074)

   # ua_date 2/14 3/14              # subtract two again
     -28.9583 days : 2008-02-14 14:26:59 (2008.045)

  Note  above  that  daylight  savings time change occured between the
  dates so an hour less than 29 days (leap year) is reported.

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

   # ua_date -45 -a                 # 45 days ago
      -45.6024 days : 2008-04-26 00:00:00 (2008.117)
   unix 'date' 042600002008.00
    days>00:00 -45.60
   hours>00:00 -1094.46
   secs.>00:00 -3940047
   ctime(1970) 0x4812e100 1209196800

   # ua_date 0x7fffffff             # specify a hex ctime date
   080610.144249 01/18/2038, 2038.018 time 18:14:07

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


RESTRICTIONS / NOTES

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

  Suggestions for enhancements or  bug  reports  can  be  directed  to
  fnkac@uaf.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 multiple options must be space sep-
  arated and the hyphen is part of the option name.


ACKNOWLEDGEMENTS

  Written at the University of Alaska.


RELATED INFORMATION

  Commands: date(1).