📄 utc.m
字号:
function t=utc(zone,isdls,format)
%UTC Get current UTC time.
% T = UTC(ZONE,ISDLS,FORMAT) returns the current UTC
% (or GMT) time in the format FORMAT given the locations
% time zone ZONE, daylight saving on/off ISDLS and output
% format FORMAT, which can be either of
%
% 'D' : serial date number
% 'YMDhms' : date vector
% 'hms' : hour, minute, second -vector
% 's' : seconds since AD (default).
%
% See also DAYLIGHT, DATEVEC, DATENUM, CLOCK.
% Copyright (c) 2002-12-08, B. Rasmus Anthin.
% Revisited 2003-06-18.
time=clock;
cmp=zone+daylight(zone,isdls);
time(3)=time(3)-(time(4)-cmp < 0);
time(4)=mod(time(4)-cmp,24);
td=datenum(time(1),time(2),time(3),time(4),time(5),time(6));
switch format
case 'D'
t=td;
case 'YMDhms'
t=time;
case 'hms'
t=time(4:6);
otherwise % case 's'
t=td*24*3600;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -