www.delorie.com/gnu/docs/gcal/gcal_76.html   search  
 
Buy GNU books!


Gcal 3.01

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

G.2.3.1 Difference value %[format]? special texts

The use of the other difference values as listed here is to calculate distance values between two dates. In case these special texts are directly lead by a `-' character, e.g. `-%d', Gcal switches the sign of the computed value.

You may depreciate the special meaning of the `-' character ---in case this character itself is needed-- by placing a `\' (backslash) character before it, e.g. `\-'. If you need the `\-' characters themselves, you have to protect the `\' (backslash) character by another `\' (backslash) character, e.g. `\\-'.

The following other difference values %[format]? special texts are respected:

%d
Specifies the current respectively queried day relative to the actual system date (==today), e.g.:

The resource file line `0 %d days gone' will be expanded to
==> `-10 days gone', in case you call Gcal with the `-c10-' option and no command.

%w
Specifies the current respectively queried week relative to the actual system date (==today). Started weeks are counted as complete weeks.

%m
Specifies the current respectively queried month relative to the actual system date (==today). Started months are counted as complete months.

%y
Specifies the current respectively queried year relative to the actual system date (==today). Started years are counted as complete years. This special text must always be trailed by a whitespace character which is removed in output!

An example:

Supposing, the actual system date is the 4th September 1999. To calculate, how many days, weeks, months and years are between the actual system date and the birthday of a person, who is born on 21st September 1962, Gcal can be called as follows:

 
$ gcal -f/dev/null -Ux -u -#'19620921 %y %m %w %d~' 1962
-|
-| -37 -444 -1928 -13497
-|
$ gcal -f/dev/null -Ux -u -#'19620921 \\-%y \-%m %w -%d~' 1962
-|
-| \--37 --444 -1928 13497
-|
$ gcal -f/dev/null -Ux -u -#'00000904 %y %m %w %d~' %19620921 1999
-|
-| 37 444 1928 13497
-|
$ gcal -f/dev/null -Ux -u -#'00000904 %y %B19620921' %19620921 1962
-|
-| 37 36

Please do not confound the relative year number %[format]y special text with the age value %B special text (see section Age value %[format]B[date] special text). The %y special text counts started years as complete years, while the %B special text does not.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003