Epoch and Unix Timestamp Conversion in Matlab
Matlab (matrix laboratory) is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. It allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages. It also provides many date time functions to handle date time functionality.
Here we will explain Matlab date time functions to get current epoch or Unix timestamp, convert timestamp to date and convert date to epoch or Unix timestamp.
Get current epoch or Unix timestamp in MatlabYou can get the current unix timestamp using following.
int32(floor(60*60*24 * (datenum(now) - datenum('01-Jan-1970')))) * 1000
Convert epoch or Unix timestamp to date in Matlab
You can convert unix timestamp to human readable date using following.
unixTimestamp = 1745034679;
date = datestr(unixTimestamp/86400 + datenum(1970,1,1));
Convert date to epoch or unix timestamp in Matlab
You can unix timestamp from human readable date using following.
int32(floor(86400 * (datenum('04-June-2025') - datenum('01-Jan-1970'))))
More about date time in Matlab
Also, read:
- Epoch and Unix Timestamp Conversion in PHP
- Epoch and Unix Timestamp Conversion in Java
- Epoch and Unix Timestamp Conversion in JavaScript
- Epoch and Unix Timestamp Conversion in Perl
- Epoch and Unix Timestamp Conversion in Python
- Epoch and Unix Timestamp Conversion in TypeScript
- Epoch and Unix Timestamp Conversion in MySQL
- Epoch and Unix Timestamp Conversion SQL Server
- Epoch and Unix Timestamp Conversion in C# (C-Sharp)
- Epoch and Unix Timestamp Conversion in Kotlin
- Epoch and Unix Timestamp Conversion in Go
- Epoch and Unix Timestamp Conversion in Ruby
- Epoch and Unix Timestamp Conversion in VBA
- Epoch and Unix Timestamp Conversion in Rust