User Commands  - now (1)

NAME

now(1f) - [TIME] print the date and time (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Examples
Limits
See Also
Author
License

SYNOPSIS

now [Format [ -date date_str|-ued Unix_time|-jed Julian_Date|-dat date_vector] [ -delta dd-hh:mm:ss]]|--help |--version|-test]

DESCRIPTION

Report the current time or a Fortran date vector in a variety of formats. Julian dates, Unix Epoch time, weekdays, monthnames, ordinal days, AM/PM and iso-8601 week-numbering are supported by building a format string containing the desired macros.

OPTIONS

Format This string, containing macro names or keywords, creates the format used to print the specified date.

The FORMAT string is expanded using the following macros:

      Description                                        Example

Base time array: (1) %Y -- year, yyyy 2022 (2) %M -- month of year, 01 to 12 01 (3) %D -- day of month, 01 to 31 09 %d -- day of month, with suffix (1st, 2nd,...) 9th (4) %Z -- minutes from UTC -0300 %z -- -+hh:mm from UTC -05:00 %T -- -+hhmm from UTC -0500 (5) %h -- hours, 00 to 23 11 %H -- hour (1 to 12, or twelve-hour clock) 11 %N -- midnight< AM <=noon; noon<= PM <midnight AM (6) %m -- minutes, 00 to 59 25 (7) %s -- sec, 00 to 59 43 (8) %x -- milliseconds 000 to 999 067 Conversions: %E -- Unix Epoch time 1641745543.0670142 %e -- integer value of Unix Epoch time 1641745543 %J -- Julian date 2459589.1845262502 %j -- integer value of Julian Date(Julian Day) 2459589 %O -- Ordinal day (day of year) 009 %o -- Whole days since Unix Epoch date 19001 %U -- day of week, 1..7 Sunday=1 1 %u -- day of week, 1..7 Monday=1 7 %i -- ISO week of year 1..53 1 %I -- iso-8601 week-numbering date(yyyy-Www-d) 2022-W01-7 Names: %l -- abbreviated month name Jan %L -- full month name January %w -- first three characters of weekday Sun %W -- weekday name Sunday %p -- phase of moon First quarter %P -- percent of way from new to full moon 45% Literals: %% -- a literal % % %t -- tab character %b -- blank character %B -- exclamation(bang) character ! %n -- new line (system dependent)

%q -- single quote (apostrophe) ’ %Q -- double quote " Program timing: %c -- CPU_TIME(3f) output 0.35747999999999995E-1 %C -- number of times this routine is used 1 %S -- seconds since last use of this format 0.0000000000000000 %k -- time in seconds from SYSTEM_CLOCK(3f) 135590.938 %K -- time in clicks from SYSTEM_CLOCK(3f) 135590945

If no percent (%) is found in the format one of several alternate substitutions occurs.

If the format is composed entirely of one of the following keywords the following substitutions occur: "iso-8601", "iso" ==> %Y-%M-%DT%h:%m:%s%z 2022-01-09T11:25:43-05:00 "iso-8601W", "isoweek" ==> %I 2022-W01-7 "sql" ==> "%Y-%M-%D %h:%m:%s.%x" "2022-01-09 11:25:43.071" "sqlday" ==> "%Y-%M-%D" "2022-01-09" "sqltime" ==> "%h:%m:%s.%x" "11:25:43.071" "rfc-2822" ==> %w, %D %l %Y %h:%m:%s %T Sun, 09 Jan 2022 11:25:43 -0500 "rfc-3339" ==> %Y-%M-%DT%h:%m:%s%z 2022-01-09T11:25:43-05:00 "date" ==> %w %l %D %h:%m:%s UTC%z %Y Sun Jan 09 11:25:43 UTC-05:00 2022 "short" ==> %w, %l %d, %Y %H:%m:%s %N UTC%z Sun, Jan 9th, 2022 11:25:43 AM UTC-05:00 "long"," " ==> %W, %L %d, %Y %H:%m:%s %N UTC%z Sunday, January 9th, 2022 11:25:43 AM UTC-05:00 "suffix" ==> %Y%D%M%h%m%s 20220901112543 "formal" ==> The %d of %L %Y The 9th of January 2022 "lord" ==> the %d day of %L in the year of our Lord %Y the 9th day of January in the year of our Lord 2022 "easter" ==> FOR THE YEAR OF THE CURRENT DATE: Easter day: the %d day of %L in the year of our Lord %Y "all" ==> A SAMPLE OF DATE FORMATS otherwise the following words are replaced with the most common macros: year %Y 2022 month %M 01 day %D 09 timezone %z -05:00 hour %h 11 minute %m 25 second %s 43 millisecond %x 073 epoch %e 1641745543 julian %j 2459589 ordinal %O 009 weekday %u 7 MONTH %L July Month %l Jul DAY %d 7th HOUR %H 10 GOOD %N AM Weekday %w Thu WEEKDAY %W Thursday Timezone %Z -240 TIMEZONE %z -04:00 if none of these keywords are found then every letter that is a macro is assumed to have an implied percent in front of it. For example: YMDhms ==> %Y%M%D%h%m%s ==> 20220109112543

-dat date_vector
  A date vector is eight integers representing a date in the same manner as the Fortran DATE_AND_TIME(3f) function: yyyy mm dd zone hh mm ss mss only numeric time zones are supported.

When present, the specified date is used instead of the current time.

-uet Unix_Epoch_Time
  When present a value is used as the Unix Epoch Time. This date is is then adjusted using any -delta value and then printed using the specified format.
-jed Julian_Date
  When present a value is used as the Julian Ephemeris Date.
-delta dd-hh:mm:ss
  Add the specified duration to the date.
-date date_str
  The guessdate(3f) routine is used to try to convert a date description to a date vector. For the guess to work, dates must either be in the form YYYY-MM-DD or the order of numeric values must be ""dd yy yyy". Only four-digit years are supported. Month names are preferred over numeric values. See the guessdate(3f) documentation for further details.
-test : To list allowed macros use the -test switch.

When present, the specified date is used instead of the current time.

EXAMPLES

Sample commands:

  now
    Friday, June 17th, 2016 03:22:53 PM UTC-4:00

now -delta 1-0:0:0 # Tomorrow Sunday, June 19th, 2016 11:32:26 AM UTC-4:00

now -delta -1-0:0:0 # Yesterday Friday, June 17th, 2016 11:32:43 AM UTC-4:00

now long -delta 7-0:0:0 # Next week Saturday, June 25th, 2016 11:32:57 AM UTC-04:00

now The date is %Y/%M/%D %h:%m:%s # user-specified formats using macros The date is 2009/08/10 00:33:48

now Y/M/D h:m:s # user-specified format with no % character 2009/08/10 00:33:48

now year-month-day # user-specified format with no % with long keywords 2016-07-29

now -dat 2016 07 23 -240 1 01 00 00 # alternate date Saturday, July 23rd, 2016 1:01:00 AM UTC-4:00

now -uet 1469250060 # alternate Unix Epoch date now -date January 4th, 1999 10:20:30 # try to determine date from description.

now YEAR=%Y MONTH=%M DAY=%D # YEAR=2009 MONTH=08 DAY=10

now HOUR=%h MINUTES=%m SECONDS=%s MILLISECONDS=%x HOUR=01 MINUTES=18 SECONDS=44 MILLISECONDS=946

# double-quotes are tricky (double them) to put in literally in this program: now ’""year-month-day"",""hour-minute-second""’ # "2017-04-23","14-41-09"

# quotes are easier to control using the single-letter macros(use %q and %Q): now QY-M-DQ,Qh:m:sQ "2017-04-23","14-41-09"

now -test # Show formatting options, handy way to look up macro names

LIMITS

See the M_time module description. Basically, A Gregorian Calendar is assumed, and Leap Seconds are not specifically accounted for.

SEE ALSO

month(1), sec2days(1), days2sec(1), easter(1), paws(1), today(1), ttee(1)

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 now (1) July 22, 2023
Generated by manServer 1.08 from 87128877-612f-440c-9391-0d3ce2d41aa0 using man macros.