# Time
{id: time}


## Dates and Time
{id: datetime}
{i: Time}
{i: Time::Span}

* [Time](https://crystal-lang.org/api/Time.html)
* [Time::Span](https://crystal-lang.org/api/Time/Span.html)

![](examples/time/my_time.cr)
![](examples/time/my_time.out)

## Sleep
{id: sleep}
{i: sleep}

* Sleep in seconds.
* It can get either and integer or a floating point number.


![](examples/time/sleep.cr)
![](examples/time/sleep.out)

## Time difference or Time::Span
{id: time-difference}

![](examples/time/time_difference.cr)
![](examples/time/time_difference.out)

## Elapsed time
{id: elapsed-time}
{i: monotonic}
{i: seconds}
{i: total_seconds}
{i: total_milliseconds}
{i: microseconds}
{i: total_microseconds}
{i: sleep}

* [Time::Span](https://crystal-lang.org/api/Time/Span.html)

![](examples/time/elapsed_time.cr)
![](examples/time/elapsed_time.out)

## Timestamp formatting
{id: timestamp-formatting}
{i: to_s}

![](examples/time/formatting.cr)
![](examples/time/formatting.out)

## Add timespan
{id: add-timespan}
{i: days}
{i: hours}
{i: minutes}
{i: seconds}

![](examples/time/add_timespan.cr)
![](examples/time/add_timespan.out)

* See these methods at [Int](https://crystal-lang.org/api/Int.html)

## Time Types
{id: time-types}

![](examples/time/types.cr)
![](examples/time/types.out)

