
Hi,
How can I display the yesterday's date?

<html>
<head>
<title>Date before current date</title>
<script type="text/javascript">
var mydate= new Date()
mydate.setDate(mydate.getDate()-1)
document.write("Yesterday Date :" +mydate.getDate()+"/"+(mydate.getMonth()+1)+"/"+mydate.getFullYear());
</script>
</head>
</html>
Description: In javascript whenever you write new Date() it shows the current date in standard format with current day,date,time and GMT.
getHours() shows hours of specified date.
getMinutes() shows minutes of specified date.
getSeconds() shows seconds of specified date.
setDate() sets the day of the month of specified date.
By above example you can easily get yesterday date.you can also put any date in myDate var and get date before myDate.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.