How To Get Difference Between Two Dates in Pendulum In Human Readable Syntax

PHOTO EMBED

Fri Sep 20 2024 17:53:20 GMT+0000 (Coordinated Universal Time)

Saved by @freepythoncode ##python #coding #python #programming #date #pendulum

import pendulum

current_date = pendulum.now().date()
uploaded_date = pendulum.date(2018, 8, 1)

diff_days = current_date.diff(uploaded_date).in_days()

print(current_date.subtract(days = diff_days).diff_for_humans()) # 6 years ago
content_copyCOPY