Konwertuj DD/MM/YYYY do YYYY-MM

15/01/2025 → 2025-01

Szybki Konwerter

2025-01

Jak Przekonwertować DD/MM/YYYY do YYYY-MM

Konwersja z DD/MM/YYYY do YYYY-MM polega na przestawieniu składników daty:

Z
DD/MM/YYYY
15/01/2025
do
YYYY-MM
2025-01
1

Zidentyfikuj Części

W DD/MM/YYYY: Day-Month-Year format commonly used in Europe, Asia, and most of the world

2

Przestaw

Przestaw, aby dopasować do formatu YYYY-MM: Year-month format following ISO 8601, ideal for file naming and sorting

3

Dostosuj Separator

Zmień separator z "/" na "-" jeśli to konieczne.

Przykłady Kodu

JavaScript
// Konwertuj DD/MM/YYYY do YYYY-MM function convertDate(dateStr) { // Parsuj DD/MM/YYYY const parts = dateStr.split('/'); const [day, month, year] = parts; // Formatuj jako YYYY-MM return `${year}-${month}-${day}`; } console.log(convertDate('15/01/2025')); // 2025-01
Python
from datetime import datetime # Konwertuj DD/MM/YYYY do YYYY-MM date_str = '15/01/2025' date = datetime.strptime(date_str, '%d/%m/%Y') result = date.strftime('%Y-%m-%d') print(result) # 2025-01

Inne Konwersje

Otwórz Pełny Konwerter →

Powiązane Strony