# datetime
{id: datetime}

## Current date and time datetime now
{id: datetime-now}
{i: datetime}
{i: now}
{i: strftime}

![](examples/datetime/datetime_now.py)


## Converting string to datetime (parsing date and time string)
{id: converting-string-to-datetime}
{i: strptime}

![](examples/datetime/converting_string_to_datetime.py)

## Parse datetime string with and without timezone information
{id: parse-datetime-string-with-and-without-timezone-information}
{i: strptime}
{i: tzinfo}

![](examples/datetime/parse_string.py)
## datetime fromisoformat
{id: datetime-from-iso-format}
{i: fromisoformat}

![](examples/datetime/datetime_fromisoformat.py)

## date fromisoformat (only date, no time)
{id: date-from-iso-format}
{i: date}
{i: fromisoformat}

![](examples/datetime/date_fromisoformat.py)

## datetime arithmeticis (subtract)
{id: datetime-arithmetics-subtract}
{i: timedelta}
{i: total_seconds}
{i: strptime}


![](examples/datetime/subtract_date.py)

## Timezone aware datetime
{id: timezone-aware-datetime}
{i: tzinfo}

![](examples/datetime/time_since.py)

## datetime arithmeticis (compare, sort)
{id: datetime-arithmetics-compare-dates}

![](examples/datetime/compare_dates.py)

## datetime arithmeticis (addition)
{id: datetime-arithmetics}

![](examples/datetime/add_timedelta.py)

## Rounding datetime object to nearest second (removing microseconds)
{id: rounding-datetime-to-seconds}
{i: microseconds}
{i: microsecond}

![](examples/datetime/datetime_rounding_seconds.py)

## Rounding datetime object to date (removing hours, minutes, seconds)
{id: rounding-datetime}
{i: microsecond}
{i: second}
{i: minute}
{i: hour}

![](examples/datetime/datetime_rounding.py)

## Convert datetime object to date object
{id: convert-datetime-to-date}
{i: datetime}
{i: now}
{i: date}

![](examples/datetime/convert_datetime_to_date.py)

## Convert datetime object to time object
{id: convert-datetime-to-time}
{i: time}

![](examples/datetime/convert_datetime_to_time.py)


## Today (date)
{id: today}
{i: date}
{i: today}

![](examples/datetime/today.py)
![](examples/datetime/today.out)

