I want to pass date today in javaScript function as a parameter, How I can do it? This is my code:

<button class="btn btn-danger" onclick="sendDate()"></button>

1 Answers

Manoj Vadehra On

If you really want to pass the object you can use:

<button class="btn btn-danger" onclick="sendDate(new Date())"></button>

But, you can use new Date() to get current date-time in the javascript method as well.