Results 1 to 2 of 2

Thread: Help With Date Please

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2012
    Posts
    63

    Help With Date Please

    I just need to display "today's date" in one of my textboxes that is readonly in the form of "mm/dd/yyy" and I have no clue how to do so. Please help, thank you

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Help With Date Please

    Try this way:
    Code:
    <script type="text/javascript">
      var d = new Date();
      var curr_date = d.getDate();
      var curr_month = d.getMonth() + 1; //months are zero based
      var curr_year = d.getFullYear();
      document.write(curr_date + "/" + curr_month + "/" + curr_year);
    </script>
    getDate(): Returns the date
    getMonth(): Returns the month
    getFullYear(): Returns the year

    Source: http://stackoverflow.com/questions/1...-in-javascript


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width