File Exchange

image thumbnail


version (1.23 KB) by Qun HAN
Retrieve the current UTC time and convert it to a MATLAB datenum.


Updated 03 Sep 2017

View Version History

View License

This function can get the current Coordinated Universal Time from the time server "" and returns it as a serial date number (datenum). The user can specify the time zone.

Cite As

Qun HAN (2021). getutc(timezone) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

Michael Gebhard

works fine, Thanks!




This function has a nice and very useful help section.

It would be worth to mention in addition, that the result is not determined by using the local clock, but by a obtaining the current time from web service. Therefore the replied time can be more accurate than CLOCK - but it is possible also, that it is *less* accurate: When the local clock is managed by NTP, the latency of the net and local computation is compensated, see . Perhaps this can be included partially in your submission also? Or perhaps you could trust the difference to the local CLOCK in rounded hours, but take local value of seconds and minutes for the output?

The line "floor(timezone);" is useless, whithout assigning the result.

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!