DelphiPythonPython GUIWindows

Learn To Build A Python GUI For Manipulating Date, Time, And Timestamps Using Arrow Library In A Delphi Windows App

blogbanner3 39

Are you looking for powerful tools to manipulate or format dates, times, and timestamps, and build a nice GUI for them? You can build it easily by combining Arrow and Python4Delphi library, inside Delphi and C++Builder.

Arrow is a Python library that offers a sensible and human-friendly approach to creating, manipulating, formatting, and converting dates, times, and timestamps. It implements and updates the datetime type, plugging gaps in functionality and providing an intelligent module API that supports many common creation scenarios. Simply put, it helps you work with dates and times with fewer imports and a lot less code.

Arrow is named after the arrow of time and is heavily inspired by moment.js and requests.

1. Why use Arrow over built-in modules?

Python’s standard library and some other low-level modules have a near-complete date, time, and timezone functionality, but don’t work very well from a usability perspective:

  • Too many modules: datetime, time, calendar, dateutil, pytz, and more.
  • Too many types: date, time, datetime, tzinfo, timedelta, relativedelta, etc.
  • Time Zones and timestamp conversions are verbose and unpleasant.
  • Timezone naivety is the norm.
  • Gaps in functionality: ISO 8601 parsing, timespans, and humanization issues.


2. Features

  • Fully-implemented, drop-in replacement for datetime
  • Support for Python 3.6+
  • Timezone-aware and UTC by default
  • Super-simple creation options for many common input scenarios
  • shift method with support for relative offsets, including weeks
  • Format and parse strings automatically
  • Wide support for the ISO 8601 standard
  • Timezone conversion
  • Support for dateutil, pytz, and Zone Info tzinfo objects
  • Generates time spans, ranges, floors, and ceilings for time frames ranging from microsecond to year
  • Humanize dates and times with a growing list of contributed locales
  • Extensible for your own Arrow-derived types
  • Full support for PEP 484-style type hints


3. Hands-On

This post will guide you on how to run various manipulations to dates, times, and timestamps using Python’s Arrow library and then display it in the Delphi Windows GUI app using Python for Delphi.

First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link.

0 rundemo1 6813476

And then, let’s run these code to print out some operations in our Python GUI:

1 1982377


Congratulations, now you have learned how to run various manipulations to dates, times, and timestamps using Python’s Arrow library and then display it in the Delphi Windows GUI app using Python for Delphi!

Check out the Arrow library for Python and use it in your projects: and

Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi:

Related posts
CodeDelphiDelphiFMXLearn PythonProjectsPythonPython GUI

How To Create A Weather App With The Python Delphi Ecosystem and Weatherstack API

CodeDelphiDelphiFMXLearn PythonProjectsPythonPython GUI

How To Create A Music Player With The Python Delphi Ecosystem


Unlock the Power of Python for Deep Learning with Transformer Architecture - The Engine Behind ChatGPT

CodeDelphiDelphiFMXLearn PythonProjectsPythonPython GUI

How to Build An Image Editor Using DelphiFMX Python Package

Leave a Reply

Your email address will not be published. Required fields are marked *