🐍

Python DD/MM/YYYY

Izvade: 15/01/2025
Ātrā atsauce
Formāta virkne
%d/%m/%Y
Izvade
15/01/2025

Formatēt datumu kā DD/MM/YYYY Python

🐍 Python
from datetime import datetime date = datetime.now() formatted = date.strftime('%d/%m/%Y') print(formatted) # Output: 31/12/2025

Parsēt datuma virkni

🐍 Python (Parsēšana)
from datetime import datetime date_string = '31/12/2025' date = datetime.strptime(date_string, '%d/%m/%Y') print(date) # Output: 2025-12-31 00:00:00

Python datuma formāta kodi

Kods Nozīme Piemērs
%d Day of month (01-31) 31
%m Month (01-12) 12
%Y Year with century 2025
%y Year without century (00-99) 25
%b Abbreviated month name Dec
%B Full month name December
%a Abbreviated weekday Wed
%A Full weekday name Wednesday

Citi formāti Python

DD/MM/YYYY citās valodās

Oficiālā dokumentācija

Lai iegūtu vairāk informācijas par datuma formatēšanu Python, skatiet oficiālo dokumentāciju:

Python datuma dokumentācija →

Saistītās lapas