# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

# etime

Time elapsed between date vectors

## Syntax

• ``e = etime(t2,t1)``
example

## Description

example

````e = etime(t2,t1)` returns the number of seconds between two date vectors or matrices of date vectors, `t1` and `t2`.```

## Examples

collapse all

Compute the time elapsed between a specific time and the current time, to 0.01-second accuracy.

Define the initial date and time and convert to date vector form.

```format shortg str = 'March 28, 2012 11:51:00'; t1 = datevec(str,'mmmm dd, yyyy HH:MM:SS') ```
```t1 = 2012 3 28 11 51 0 ```

Determine the current date and time.

```t2 = clock ```
```t2 = 2016 8 30 12 44 39.625 ```

The `clock` function returns the current date and time as a date vector.

Use `etime` to compute the number of seconds between `t1` and `t2`.

```e = etime(t2,t1) ```
```e = 1.3963e+08 ```

## Input Arguments

collapse all

Date vectors, specified as 1-by-6 vectors or `m`-by-6 matrices containing `m` full date vectors in the format:`[Year Month Day Hour Minute Second]`.

Example: `[2012 03 27 11 50 01]`

Data Types: `double`

collapse all

### Tips

• To time the duration of an event, use the `timeit` or `tic` and `toc` functions instead of `clock` and `etime`. The `clock` function is based on the system time, which can be adjusted periodically by the operating system, and thus might not be reliable in time comparison operations.

### Algorithms

`etime` does not account for the following:

• Leap seconds.

• Differences in time zones.