Skip to content

Formatting

Since dateconv converts all epoch strings to a Golang time 1 object, you can perform any operations supported by this package directly on the Epoch property. Additionally you are able to receive the following formats.

Initialize an Object

Initialize Datetime Object
obj, _ := dateconv.NewConversion("2022-01-01", "date", "")

Modified Julian Date (MJD)

The MJD therefore gives the number of days since midnight on November 17, 1858. This date corresponds to 2400000.5 days after day 0 of the Julian calendar.

When called with the parameter full=True it includes the fraction of the day.

MJD (int)
obj.Mjd(false)
// 59580
MJD (float)
obj.Mjd(true)
// 59580.00000

GPS Week and Day

The continious count of GPS weeks started on Jan 6, 1980. A GPS week starts on Sunday (GPSD=0) at 00:00 GPS time and ends on Saturday (GPSD=6) at 23:59 GPS time.

GPS Week
obj.Gpsw()
// 2190

obj.Gpsd()
// 6

obj.GpsWsec()
// 518400

obj.GpsWsecDay()
// ...

obj.GpsWsecHour()
// ...

SINEX Format

Datetime as used in the SINEX (Solution INdependent EXchange Format) format 2.

SINEX
obj.Sinex()
// 2022:001:00000

RINEX Epoch

A datetime string as used in the RINEX epoch lines.

RINEX v.3 Epoch
obj.RinexV3EpochDate()
// 2022 01 01 00 00 00.0000000
RINEX v.2 Epoch
obj.RinexV2EpochDate()
// 22 01 01 00 00 00.0000000

RINEX Filenames

Currently, RINEX v.4/v.3 and RINEX v.2 filenames are supported. If you like to substitute a specific pattern, please refer to Usage::Operations.

RINEX v.3
obj.Rinex3()
// 20220010000
RINEX v.2 daily
obj.Rinex2("D")
// 0010.22
RINEX v.2 hourly
obj.Rinex2("H")
// 001a.22
RINEX v.2 sub-hourly
obj.Rinex2("Q")
// 001a00.22

GFZ CHAMP Filenames

A GFZ internal filename that was defined in the era of the CHAMP satellite mission (2000).

CHAMP
obj.Champ("")
// 21906az0000

When called with a parameter interval the datetime will be rounded to the seconds given.

CHAMP (rounded)
obj, _ := dateconv.NewConversion("2022-01-01 00:17:00", "datetime", "")
obj.Champ("15M")
// 21906az0900

ISO Datetimes

ISO 8601
obj.Iso8601()
// 2022-01-01T00:00:00Z

UNIX Seconds

Converts to seconds since Jan 1, 1970 UTC.

UNIX
obj.Unix()
// 1640995200
UNIX with nanosecond resolution
obj.UnixNano()
// 1640995200
UNIX with microsecond resolution
obj.UnixMicro()
// 1640995200

  1. https://pkg.go.dev/time 

  2. https://files.igs.org/pub/data/format/sinex_v210_proposal.pdf