Virginia Institute of Marine Science ERDDAP
Easier access to scientific data
Brought to you by NOAA NMFS SWFSC ERD
Reset the form to the default values.
Or, bypass this web page and do time conversions from within a computer program, script, or web page.
Notes about the Time Converter
The first word can be (upper or lower case):
ms, msec, msecs, millis, millisecond, milliseconds,
s, sec, secs, second, seconds,
m, min, mins, minute, minutes,
h, hr, hrs, hour, hours,
d, day, days,
mon, mons, month, months,
yr, yrs, year, or years.
"since" is required.
The time can be any time in the format yyyy-MM-ddTHH:mm:ss.SSSZ,
where Z is 'Z' or a ±hh or ±hh:mm offset from the Zulu/GMT time zone.
If you omit Z and the offset, the Zulu/GMT time zone is used.
Separately, if you omit .SSS, :ss.SSS, :mm:ss.SSS, or Thh:mm:ss.SSS, the
missing fields are assumed to be 0.
So another example is "hours since 0001-01-01".
Technically, ERDDAP does NOT follow the UDUNITS standard when converting "years since"
and "months since" time values to "seconds since". The UDUNITS standard defines a
year as a fixed, single value: 3.15569259747e7 seconds. And UDUNITS defines a month
as year/12. Unfortunately, most/all datasets that we have seen that use
"years since" or "months since" clearly intend the values to be calendar years
or calendar months. For example, "3 months since 1970-01-01" is usually intended
to mean 1970-04-01. So, ERDDAP interprets "years since" and "months since" as
calendar years and months, and does not strictly follow the UDUNITS standard.
How ERDDAP Deals with Time
project stores time as "days since -4713-01-01T00:00:00Z",
which is a reference to midnight at the start of January 1, 4713 BCE, which
is the start time for Chronological Julian Dates (CJD). So, in the datasets.xml
setup for a SeaDataNet dataset in ERDDAP, in the <addAttributes> section for
all time variables, you need to add
<att name="units">days since -4712-01-01T00:00:00Z</att>
so that 4713 BCE is expressed as the Astronomical Year Number -4712.
As a check, note the start of Chronological Julian day number 2,452,952
(or, 2452952 "days since -4712-01-01") is 2003-11-08T00:00:00Z.
Percent Encoding - The parameter values in the URL (the parts after '=' signs) must be properly
percent encoded: all characters other than A-Za-z0-9_-!.~'()* must be encoded as %HH,
where HH is the 2 digit hexadecimal value of the character, for example, a space becomes
%20. Characters above #127 must be converted to UTF-8 bytes, then each UTF-8 byte must
be percent encoded (ask a programmer for help). There are
web sites that percent encode and decode for you.