Results 1 to 6 of 6

Thread: Date Object In Javascript

  1. #1
    Join Date
    Nov 2009
    Posts
    862

    Date Object In Javascript

    Hello, I want to know the details about the Date object in java script. I have search different online tutorials about it, but It is quiet complicated to know it. So, if you provide me some basic information about it, then I can able to know more about the date object. So, please provide me either script related to it or just provide me point wise details.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Date Object In Javascript

    The object Date can work with all variables affecting dates and time management. It is an object included natively in JavaScript, and that we can always use. The date is stored in a variable as a string that contains the day, month, year, hour, minutes and seconds. It is therefore difficult access to only one element of an object dateSince each element can have a variable size. Fortunately, the methods of the object Date provide a simple way to access a single item, or to modify it. Their syntax is as follows:
    Code:
    Objet_Date.Methode ()

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Date Object In Javascript

    The syntax for creating an object-date may be one of the following:
    • First = new Date ()
      This syntax is used to store the date and time current
    • Second = new Date ( "month day, year hours: minutes: seconds)
      parameters are a string in this notation
    • Third = new Date (year, month, day)
      parameters are three integers separated by commas.
      Omitted parameters are set to zero by default
    • Fourth = new Date (year, month, day, hours, minutes, seconds)
      parameters are six integers separated by commas.
      Omitted parameters are set to zero by default

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Date Object In Javascript

    Date Object In Javascript provides you the following methods:
    • getDate ()
    • getDay ()
    • getHours ()
    • getMinutes ()
    • getMonth ()
    • getTime ()
    • getTimezoneOffset ()

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Date Object In Javascript

    If you want to change the Date object format in your output then you must need to make use of the mehod below:
    • toGMTString ()
    • toLocaleString ()

    If you want to change the Date which is already exist in the database then yo must need to make use of the mehod below:
    • setDate (<DATE>)
    • setDay (<DATE>)
    • setHours (<DATE>)
    • setMinutes (<DATE>)
    • setMonth (<DATE>)
    • setTime (<DATE>)

  6. #6
    Join Date
    May 2008
    Posts
    2,297

    Re: Date Object In Javascript

    If you make use of the date object in the javascript then it will work with the date and time. If you want to create the date object then simply create a Date() constructor as below:
    Code:
    <h2>It is now  
    <script type="text/javascript">
    <!--
    var currT = new Date()
    var mon = currT.getMonth() + 1
    var day = currT.getDate()
    var yer = currT.getFullYear()
    document.write(month + "/" + day + "/" + year)
    //-->
    </script>
    </h2>

Similar Threads

  1. How to setup a JavaScript Object Notation variable?
    By hatred in forum Software Development
    Replies: 4
    Last Post: 04-02-2010, 02:25 AM
  2. JavaScript - The window object
    By Sheenas in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 11:38 AM
  3. History Object In JavaScript
    By ramsun in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 10:17 AM
  4. Location Object In JavaScript
    By technika in forum Software Development
    Replies: 5
    Last Post: 23-01-2010, 09:24 AM
  5. JavaScript: RegExp and Boolean Object
    By Ivann in forum Software Development
    Replies: 5
    Last Post: 18-12-2009, 03:36 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,482,102.62302 seconds with 17 queries