.. highlightlang:: us .. index:: DT_UnixTime .. _dt_unixtime: DT_UnixTime ============ .. us.tag DT_UnixTime ENGLISH DT_FUNC New5905 :ref:`DT_UnixTime` converts the Unix time value into the date/time format used by UniPlot. .. function:: rvDateTime = DT_UnixTime(rvUnixTime) rvDateTime = DT_UnixTime(rvUnixTime, ssUnit) .. us.return **Return Value** *rvDateTime* is a vector with Date/Time values used by UniPlot: Days are represented by whole number increments starting with 31 December 1899, midnight as time zero. Hour values are expressed as the absolute value of the fractional part of the number. In case of an error the function returns -1. .. us.params **Parameters** .. uparam:: rvUnixTime *rvUniTime* is a real vector with unix time stamps. The time stamp values are seconds, millseconds or microseconds since 1970-01-01 00:00:00 UTC. .. uparam:: ssUnit String with the unit text of the given timestamps: ``s``, ``ms`` or ``μs``. If this parameter is not specified, the function will calculate the unit as following:: if (all(rvUnixTime > 5e8 && rvUnixTime < 1.9e9)) { // 05.11.1985 to 17.03.2030 ssUnit = "s"; } else if (all(rvUnixTime > 5e11 && rvUnixTime < 1.9e12)) { // 05.11.1985 to 17.03.2030 ssUnit = "ms" } else if (all(rvUnixTime > 5e14 && rvUnixTime < 1.9e15)) { // 05.11.1985 to 17.03.2030 ssUnit = "μs" } .. us.comment **Comment** Calculation of UniPlot time:: // days from 01.01.1900 to 01.01.1970: 25569 Days // Seconds in a day: 86400 if (ssUnit == "s") { return rvUnixTime ./ 86400 + 25569; } else if (ssUnit == "ms") { return rvUnixTime ./ (86400 * 1e3) + 25569; } else if (ssUnit == "μs") { return rvUnixTime ./ (86400 * 1e6) + 25569; } .. seealso:: :ref:`overview-date-and-time`, :ref:`DT_Format` :sub:`id-1580356`