File Exchange

image thumbnail

Epoch & Unix Timestamp Converter (epoch2UTC)

version (1.44 KB) by Dr. Erol Kalkan, P.E.
Converts an epoch/unix timestamp into a human readable date

1 Download

Updated 17 May 2017

View License

A simple function that converts an epoch/unix timestamp into a human readable date
Output is both a vector of [Y, M, D, H, MN, S] saved in "dv" and a standard date (e.g., 04-Oct-2017 20:00:30) saved in "y"
Syntax: [y, dv] = epoch2UTC(epoch)

Comments and Ratings (1)


Mikhail (view profile)

Here is the reverse:

function epoch = UTC2epoch(y)
% UTC2epoch('22-May-2017 08:00:00')
epoch = seconds(datetime(y)-datetime('01-Jan-1970 00:00:00'));

BTW, 719529 is your function is the number of days since 1-1-0000, if anybody wonders.

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux

MATLAB Online Live Editor Challenge

View the winning live scripts from faculty and students who participated in the recent challenge.

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video