Hi,
How to convert Date string to dd/MM/yyyy format in JavaScript?
var dt = new Date(2025, 01, 15);
Hi makenzi.exc,
Refer below example.
HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> body { font-family: Arial; font-size: 10pt; } </style> </head> <body> <input type="button" value="Submit" onclick="GetFormatedDate()" /> <script type="text/javascript"> function GetFormatedDate() { var dt = new Date(2025, 01, 15); // Get Year. var year = dt.getFullYear(); // Get Month. var month = dt.getMonth() + 1; // Get Date. var date = dt.getDate(); if (date < 10) { date = date.toString().padStart(2, '0') }; if (month < 10) { month = month.toString().padStart(2, '0') }; alert(date + '/' + month + '/' + year); }; </script> </body> </html>
Demo
Screenshot
Downloads
Download Sample
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.