Today's Date using JavaScript?

Posted by Laghaterohan under JavaScript on 11/9/2010 | Points: 10 | Views : 10666 | Status : [Member] | Replies : 5
Hello,

I have text box in which i enter date in dd/MM/yyyy format using calendar control. However i need to check this date with Today's date. The date entered in the Textbox should be greater than Today's date. For this validation i am using JavaScript.

My question is how to get today's date in dd/MM/yyyy format using JavaScript ?

Thanks!!!

Best Regards,
Rohan Laghate



Responses

Posted by: SheoNarayan on: 11/9/2010 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Read this article, you have solution of all date related stuffs in JavaScript http://www.tizag.com/javascriptT/javascriptdate.php

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Tripati_tutu on: 11/9/2010 [Member] Bronze | Points: 25

Up
0
Down
Hello Laghaterohan,

For your query given, I have a code snippet to get todays date in dd/mm/yyyy format as mentioned below.

<script type="text/javascript">

<!--
var currentTime = new Date()
var day = currentTime.getDate()
var month = currentTime.getMonth() + 1
var year = currentTime.getFullYear()
document.write(day + "/" + month + "/" + year)
//-->
</script>


You just try this code in your program and you will get the todays date in the above mentioned format.

Thanks


Best Regards,
Tripati

Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prasham on: 11/10/2010 [Member] Starter | Points: 25

Up
0
Down
Hello,

For your reference,

http://www.w3schools.com/jS/js_obj_date.asp
http://ncthakur.itgo.com/js07.htm
http://www.webdevelopersnotes.com/tips/html/10_ways_to_format_time_and_date_using_javascript.php3

Thanks and Best Regards
Prasham

Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sidharth.V on: 12/4/2012 [Member] Starter | Points: 25

Up
0
Down
Hello Tripati,

Ur solution was the simplest and the easiest to implement :)

Thanks

Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sidharth.V on: 12/4/2012 [Member] Starter | Points: 25

Up
0
Down
Hello Tripati,

Ur solution was the simplest and the easiest to implement :)

Thanks

Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response