Construct empty TIME object
Construct a TIME object by loading the object from a file
Construct a TIME object from a string
Construct a TIME object from a string and time format
Construct a TIME object from the unix epoch time
Construct a TIME object from a parameter list (PLIST) object

Construct empty TIME object

The following example creates an empty time object

t = time()
---------- time 01 ----------

name           : None
utc_epoch_milli: 1206904199919
timezone       : UTC
timeformat     : yyyy-mm-dd HH:MM:SS.FFF
time_str       : 2008-03-30 19:09:59.919

created        : 2008-03-30 19:09:59.919
version        : $Id: time.m,v 1.33 2008/03/27 13:59:06 mauro Exp
plist          :
-----------------------------

Construct a TIME object by loading the object from a file

The following example creates a new time object by loading the time object from disk.

t = time('time.mat')
t = time('time.xml')

Construct a TIME object from a string

Create a time object with different string formats.

t1 = time('14:00:00')              % HH:MM:SS
t1 = time('14:00:00.123')          % HH:MM:SS.FFF
t2 = time('2008.04.01 17:00:00')   % yyyy.mm.dd. HH:MM:SS
t3 = time('17:00:00 2008.04.01')   % HH:MM:SS yyyy.mm.dd
t4 = time('17:00:00 2008-04-01')   % HH:MM:SS yyyy-mm-dd

You can combine the following string formats:


Construct a TIME object from a string and time format

Create a time object with different string formats and a time format. The time format is either a MATLAB format string or a MATLAB format number.

t1 = time('14:00:00', 'HH:MM:SS')
t2 = time('14:00:00', 'yyyy.mm.dd HH:MM:SS')
t3 = time('14:00:00', 31)
t4 = time('14:00:00', 17)

Construct a TIME object from the unix epoch time

Create a time objrct from the unix epoch time. The epoch time starts from '1970-01-01 00:00:00.000'
Remark: the epoch time must be in milliseconds

t1 = time(0)
t2 = time(1206900000000) % 2008-03-30 18:00:00

Construct a TIME object from a parameter list (PLIST) object

Use the key word 'utc_epoch_milli'

Construct a TIME by its properties definition

'utc_epoch_milli'

The time in milliseconds [default: 0]

Additional parameters:

'timezone'

Timezone (string or java object) [default: 'UTC']

'timeformat'

Time format (string)
[default: 'yyyy-mm-dd HH:MM:SS.FFF']

pl1 = plist('utc_epoch_milli', 1206900000000);
pl2 = plist('utc_epoch_milli', 1206900000000, ...
            'timeformat',      'HH:MM:SS',    ...
            'timezone',        'CET');

t1 = time(pl1)
t2 = time(pl2)

Use the key word 'time_str'

Construct a TIME by its properties definition

'time_str'

the time string [default: '1970-01-01 00:00:00.000']

Additional parameters:

'timezone'

Timezone (string or java object) [default: 'UTC']

'timeformat'

Time format (string)
[default: 'yyyy-mm-dd HH:MM:SS.FFF']

pl1 = plist('time_str', '14:00:00 15.01.2008');
pl2 = plist('time_str', '14:00:00 15.01.2008', ...
            'timeformat',      'HH:MM:SS',        ...
            'timezone',        'CET');

t1 = time(pl1)
t2 = time(pl2)