Hello,
I want to format date to 'MM/DD/YYYY', is there a way to automatically fill in leading zero for single digit date if user enter 1/2/03 to 01/02/2003.. ?
i am trying to format a date as well but in the following format... yyyy-mm-dd. I would like the month and day to have a leading zero if less than 10. I tried the given solution but it doesn't work for me. Can anyone help out with a different solution? Thanks.
<SCRIPT LANGUAGE = "JavaScript">
function ValidDate(sDate)
{
var expression = /[0123]\d\/[01]\d\/\d{4}/;
return expression.test(sDate);
}
</script>
pass in sDate in string format
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.