Mercurial > hg > octave-nkf
comparison scripts/time/datenum.m @ 11587:c792872f8942
all script files: untabify and strip trailing whitespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:35:29 -0500 |
parents | fd0a3ac60b0e |
children | d0b799dafede |
comparison
equal
deleted
inserted
replaced
11586:12df7854fa7c | 11587:c792872f8942 |
---|---|
22 ## @deftypefnx {Function File} {} datenum (@var{year}, @var{month}, @var{day}, @var{hour}, @var{minute}) | 22 ## @deftypefnx {Function File} {} datenum (@var{year}, @var{month}, @var{day}, @var{hour}, @var{minute}) |
23 ## @deftypefnx {Function File} {} datenum (@var{year}, @var{month}, @var{day}, @var{hour}, @var{minute}, @var{second}) | 23 ## @deftypefnx {Function File} {} datenum (@var{year}, @var{month}, @var{day}, @var{hour}, @var{minute}, @var{second}) |
24 ## @deftypefnx {Function File} {} datenum (@code{"date"}) | 24 ## @deftypefnx {Function File} {} datenum (@code{"date"}) |
25 ## @deftypefnx {Function File} {} datenum (@code{"date"}, @var{p}) | 25 ## @deftypefnx {Function File} {} datenum (@code{"date"}, @var{p}) |
26 ## Returns the specified local time as a day number, with Jan 1, 0000 | 26 ## Returns the specified local time as a day number, with Jan 1, 0000 |
27 ## being day 1. By this reckoning, Jan 1, 1970 is day number 719529. | 27 ## being day 1. By this reckoning, Jan 1, 1970 is day number 719529. |
28 ## The fractional portion, @var{p}, corresponds to the portion of the | 28 ## The fractional portion, @var{p}, corresponds to the portion of the |
29 ## specified day. | 29 ## specified day. |
30 ## | 30 ## |
31 ## Notes: | 31 ## Notes: |
32 ## | 32 ## |
51 ## @end itemize | 51 ## @end itemize |
52 ## | 52 ## |
53 ## @strong{Warning:} this function does not attempt to handle Julian | 53 ## @strong{Warning:} this function does not attempt to handle Julian |
54 ## calendars so dates before Octave 15, 1582 are wrong by as much | 54 ## calendars so dates before Octave 15, 1582 are wrong by as much |
55 ## as eleven days. Also be aware that only Roman Catholic countries | 55 ## as eleven days. Also be aware that only Roman Catholic countries |
56 ## adopted the calendar in 1582. It took until 1924 for it to be | 56 ## adopted the calendar in 1582. It took until 1924 for it to be |
57 ## adopted everywhere. See the Wikipedia entry on the Gregorian | 57 ## adopted everywhere. See the Wikipedia entry on the Gregorian |
58 ## calendar for more details. | 58 ## calendar for more details. |
59 ## | 59 ## |
60 ## @strong{Warning:} leap seconds are ignored. A table of leap seconds | 60 ## @strong{Warning:} leap seconds are ignored. A table of leap seconds |
61 ## is available on the Wikipedia entry for leap seconds. | 61 ## is available on the Wikipedia entry for leap seconds. |
62 ## @seealso{date, clock, now, datestr, datevec, calendar, weekday} | 62 ## @seealso{date, clock, now, datestr, datevec, calendar, weekday} |
92 if (nc >= 5) minute = year(:,5); endif | 92 if (nc >= 5) minute = year(:,5); endif |
93 if (nc >= 4) hour = year(:,4); endif | 93 if (nc >= 4) hour = year(:,4); endif |
94 day = year(:,3); | 94 day = year(:,3); |
95 month = year(:,2); | 95 month = year(:,2); |
96 year = year(:,1); | 96 year = year(:,1); |
97 endif | 97 endif |
98 endif | 98 endif |
99 | 99 |
100 month(month<1) = 1; ## For compatibility. Otherwise allow negative months. | 100 month(month<1) = 1; ## For compatibility. Otherwise allow negative months. |
101 | 101 |
102 ## Set start of year to March by moving Jan. and Feb. to previous year. | 102 ## Set start of year to March by moving Jan. and Feb. to previous year. |