Arrow is a Python module for working with date and time. It offers a sensible and human-friendly approach to creating, manipulating, formatting and converting dates, times and timestamps. It allows easy creation of date and time instances with timezone awareness.
The arrow module is installed with the following command:
pip install arrow
- User friendly.
- Timezone-aware and UTC by default.
- Timezone conversion.
- Time frame ranging from microsecond to year.
- Easy to use.
- Formats and parses strings automatically.
- Supports a growing list of contributed locales.
Getting UTC (Universal Time Coordinated) time.
In order to get current UTC time we use
Current UTC Time is = 2020-02-28T18:06:39.228924+00:00
Getting Indian time.
In order to get current regional(Indian) time we use
Current India Time = 2020-02-28T23:40:07.112695+05:30
Parsing string to date
In order to parse the string into date format we use
Unix time is a system for describing a point in time. It is the number of seconds that have elapsed since the Unix epoch, that is the time 00:00:00 UTC on 1 January 1970, minus leap seconds.
timestamp()method is used to get unix time.
fromtimestamp()method used to convert the Unix time back to the arrow date object.
2020-03-04T13:33:15.041536+00:00 1583328795 2020-03-04T19:03:15+05:30
Arrow instance from datetime
An instance of the arrow module can also be created from the DateTime module. Consider the below example for a better understanding of the topic.
2020-03-04 19:16:04.317690 2020-03-04T00:00:00+00:00
- matplotlib.pyplot.arrow() in Python
- Matplotlib.patches.Arrow Class in Python
- Python - Drawing design using arrow keys in PyGame
- grp module in Python
- pwd module in Python
- twitter-text-python (ttp) module - Python
- MySQL-Connector-Python module in Python
- Pyscaffold module in Python
- struct module in Python
- OS Module in Python with Examples
- Keyword Module in Python
- Wikipedia module in Python
- Pyperclip module in Python
- Python winsound module
- Pygorithm module in Python
- Functools module in Python
- Platform Module in Python
- OS Path module in Python
- C API from Extension Module in Python | Set 2
- C API from Extension Module in Python | Set 1
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.