I-convert ang YYYY-MM-DD sa DD/MM/YYYY
2025-01-15 → 15/01/2025
Mabilis na Converter
→
15/01/2025
Paano I-convert ang YYYY-MM-DD sa DD/MM/YYYY
Ang pag-convert mula YYYY-MM-DD sa DD/MM/YYYY ay kinabibilangan ng muling pag-aayos ng mga bahagi ng petsa:
Mula sa
YYYY-MM-DD
2025-01-15
sa
DD/MM/YYYY
15/01/2025
1
Tukuyin ang mga Bahagi
Sa YYYY-MM-DD: ISO 8601 standard format, ideal for sorting and international use
2
Ayusin Muli
Muling ayusin upang tumugma sa format na DD/MM/YYYY: Day-Month-Year format commonly used in Europe, Asia, and most of the world
3
Ayusin ang Separator
Baguhin ang separator mula "-" sa "/" kung kinakailangan.
Mga Halimbawa ng Code
JavaScript
// I-convert ang YYYY-MM-DD sa DD/MM/YYYY
function convertDate(dateStr) {
// I-parse ang YYYY-MM-DD
const parts = dateStr.split('-');
const [year, month, day] = parts;
// I-format bilang DD/MM/YYYY
return `${day}/${month}/${year}`;
}
console.log(convertDate('2025-01-15')); // 15/01/2025
Python
from datetime import datetime
# I-convert ang YYYY-MM-DD sa DD/MM/YYYY
date_str = '2025-01-15'
date = datetime.strptime(date_str, '%Y-%m-%d')
result = date.strftime('%d/%m/%Y')
print(result) # 15/01/2025