แปลง MM/DD/YYYY เป็น DD/MM/YYYY

01/15/2025 → 15/01/2025

ตัวแปลงด่วน

15/01/2025

วิธีแปลง MM/DD/YYYY เป็น DD/MM/YYYY

การแปลงจาก MM/DD/YYYY เป็น DD/MM/YYYY ต้องจัดเรียงส่วนประกอบวันที่ใหม่:

จาก
MM/DD/YYYY
01/15/2025
เป็น
DD/MM/YYYY
15/01/2025
1

ระบุส่วนประกอบ

ในรูปแบบ MM/DD/YYYY: Month-Day-Year format primarily used in the United States

2

จัดเรียงใหม่

จัดลำดับใหม่ให้ตรงกับรูปแบบ DD/MM/YYYY: Day-Month-Year format commonly used in Europe, Asia, and most of the world

3

ปรับตัวคั่น

เปลี่ยนตัวคั่นจาก "/" เป็น "/" หากจำเป็น

ตัวอย่างโค้ด

JavaScript
// แปลง MM/DD/YYYY เป็น DD/MM/YYYY function convertDate(dateStr) { // แปลง MM/DD/YYYY const parts = dateStr.split('/'); const [month, day, year] = parts; // จัดรูปแบบเป็น DD/MM/YYYY return `${day}/${month}/${year}`; } console.log(convertDate('01/15/2025')); // 15/01/2025
Python
from datetime import datetime # แปลง MM/DD/YYYY เป็น DD/MM/YYYY date_str = '01/15/2025' date = datetime.strptime(date_str, '%m/%d/%Y') result = date.strftime('%d/%m/%Y') print(result) # 15/01/2025

การแปลงอื่นๆ

เปิดตัวแปลงเต็ม →

หน้าที่เกี่ยวข้อง