There are many varieties, according to the value of type
as defined
in ‘Details’.
numberAsPOSIXct(t, type, tz = "UTC")
t  an integer corresponding to a time, in a way that depends on


type  the type of time (see “Details”). 
tz  a string indicating the time zone, used only for unix and matlab times, since GPS times are always referenced to the UTC timezone. 
A POSIXct()
time vector.
"unix"
handles Unix times, measured in seconds since the start
of the year 1970.
"matlab"
handles Matlab times, measured in days since what
MathWorks (reference 1) calls ``January 0, 0000'' (i.e. ISOdatetime(0, 1, 1, 0,
0, 0)
in R notation).
"gps"
handles the GPS convention. For this, t
is a
twocolumn matrix, with the first column being the the GPS "week"
(referenced to 19990822) and the second being the GPS "second" (i.e. the
second within the week). Since the GPS satellites do not handle leap
seconds, the Rdefined .leap.seconds
is used for corrections.
"argo"
handles Argo times, measured in days since the start of
the year 1900.
"excel"
handles Excel times, measured in days since the start of
the year 1900. (Note that excel incorrectly regards 1900 as a leap year,
so 1 day is subtracted from t
unless the time is less than or equal
to 1900 Feb 28. Note that NA is returned for the day 60, which is
what excel codes for "Feb 29, 1900", the nonexisting day that excel
accepts.
"ncep1"
handles NCEP times, measured in hours since the start
of the year 1800.
"ncep2"
handles NCEP times, measured in days since the start of
the year 1. (Note that, for reasons that are unknown at this time, a simple
R expression of this definition is out by two days compared with the UDUNITS
library, which is used by NCEP. Therefore, a twoday offset is applied. See
references 2 and 3.)
"sas"
handles SAS times, indicated by type="sas"
, have
origin at the start of 1960.
"spss"
handles SPSS times, in seconds after 15821014.
"yearday"
handles a convention in which t
is a
twocolumn matrix, with the first column being the year, and the second the
yearday (starting at 1 for the first second of January 1, to match the
convention used by SeaBird CTD software).
"epic"
handles a convention used in the EPIC software library,
from the Pacific Marine Environmental Laboratory, in which t
is a
twocolumn matrix, with the first column being the julian Day (as defined in
julianDay()
, for example), and with the second column being the
millisecond within that day. See reference 4.
"vms"
handles a convention used in the VMS operating system and
for Modified Julian Day, in which t
is the number of seconds
past 18591117T00:00:00 UTC. See reference 5.
Matlab times: http://www.mathworks.com/help/matlab/ref/datenum.html
NCEP times: https://www.esrl.noaa.gov/psd/data/gridded/faq.html#3
problem with NCEP times: https://github.com/dankelley/oce/issues/738
EPIC times: software and manuals at https://www.pmel.noaa.gov/epic/download/index.html#epslib; see also Denbo, Donald W., and Nancy N. Soreide. “EPIC.” Oceanography 9 (1996). https://doi.org/10.5670/oceanog.1996.10.
VMS times: https://en.wikipedia.org/wiki/Epoch_(computing)
Other things related to time:
ctimeToSeconds()
,
julianCenturyAnomaly()
,
julianDay()
,
numberAsHMS()
,
secondsToCtime()
,
unabbreviateYear()
numberAsPOSIXct(0) # unix time 0#> [1] "19700101 UTC"numberAsPOSIXct(1, type="matlab") # matlab time 1#> [1] "00000101 UTC"#> [1] "20100701 UTC"#> [1] "20130101 UTC"## Epic time, one hour into Canada Day of year 2018. In computing the ## Julian day, note that this starts at noon. jd < julianDay(as.POSIXct("20180701 12:00:00", tz="UTC")) numberAsPOSIXct(cbind(jd, 1e3 * 1 * 3600), type="epic", tz="UTC")#> [1] "20180701 01:00:00 UTC"