XK8ER
asked on
get date
hello there,
this code is working fine but for some reason when that date is between 1st and 9th of the month it wont give day 01 or day 05...
it just gives 1 or 5.. how can I make it so that it always returns two digits for the day and month?
this code is working fine but for some reason when that date is between 1st and 9th of the month it wont give day 01 or day 05...
it just gives 1 or 5.. how can I make it so that it always returns two digits for the day and month?
<script type="text/javascript">
var curdate = new Date();
var year = curdate.getFullYear();
var month = curdate.getMonth() + 1;
var day = curdate.getDate();
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might want to take a look at this article: Can I have a date?
https://www.experts-exchange.com/A_484.html
https://www.experts-exchange.com/A_484.html
Raj