Parse a date string

EasyDatetime Programs · 3 of 20

Write a Python program to convert the string “15/08/2026 09:30” into a datetime.

Advertisement
Output
2026-08-15 09:30:00 Saturday

Approach

  1. datetime.strptime(text, format).

Solution

Python
from datetime import datetime dt = datetime.strptime("15/08/2026 09:30", "%d/%m/%Y %H:%M")print(dt, dt.strftime("%A"))
Output
2026-08-15 09:30:00 Saturday

Learn the concept

New to this topic? Read the lesson, then come back.

More datetime programs

← All 20 Datetime Programs

Leave a Comment