Python Arrow To Show Human Friendly Time

Arrow is a python library and command-line tool to genrerate, manipulate dates, times, timestamps.

use of arrow:

With the use of arrow, we can also create, manipulate, format and convert dates, times, and timestamps, convert timezones, generates time spans, ranges, floors and ceilings  with a less code.


We can install arrow using the pip command.

  pip install arrow

Arrow Functions:

Creating Date and time:

To get the UTC time:

import arrow

utc = arrow.utcnow()

Here UTC will give date and time, utc.year will give year value, will dive only date object, a.time() will give only time

To Convert into specific timezone with a specific format:

arrow.utcnow().to('Asia/Calcutta').format('YYYY-MM-DD HH:mm:ss'),

To convert date time object into arrow object with specific time zone:

arrow.get('2013-05-05 12:30:45', 'YYYY-MM-DD HH:mm:ss')

To replace the date time, we can use replace function with hours, minutes, seconds attribute:

arrow.get(b).to('YYYY-MM-DD HH:mm:ss')

arrow.replace(year=2016, month=2)


To get the time difference in words, we can use the below function:


Posted On 22 January 2016 By MicroPyramid

Need any Help in your Project?Let's Talk

Latest Comments
Working with python collections part 1

Python Collections - named tuple is to access by the names specified and deque is to append and pop the elements from both sides of ...

Continue Reading...
Converting Audio and Video files using FFMPEG Tool

FFMPEG is a command-line tool that converts audio or video to required formats, which handle multimedia data. It can also capture and encode in real-time.

Continue Reading...
WSGI explanation with simple APP

The main goal of WSGI is to facilitate easy interconnection of servers and web frameworks/applications. WSGI defines a standerd API for web servers(uWSGI, Twisted, Gunicorn) ...

Continue Reading...

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties