Page 161 - DCAP408_WEB_PROGRAMMING
P. 161

Unit 5: Scripting Language




              setMilliseconds()   Sets the  milliseconds (from 0-999)                           Notes
              setMinutes()        Set the minutes (from  0-59)
              setMonth()          Sets the month (from 0-11)
              setSeconds()        Sets the seconds (from  0-59)

              setTime()           Sets a date and time by adding or subtracting a specified number
                                  of milliseconds to/from midnight  January 1,  1970
              setUTCDate()        Sets the day of the month, according to universal time (from 1-31)

              setUTCFullYear()    Sets the year, according to universal time (four digits)
              setUTCHours()       Sets the hour, according to universal time (from 0-23)
              setUTCMilliseconds()  Sets the  milliseconds, according to universal time (from 0-999)

              setUTCMinutes()     Set the minutes, according to universal time (from 0-59)
              setUTCMonth()       Sets the month, according to universal time (from 0-11)
              setUTCSeconds()     Set the seconds, according to universal time (from  0-59)
              setYear()           Deprecated. Use the  setFullYear() method instead
              toDateString()      Converts the date portion of a Date object into a readable string

              toGMTString()       Deprecated. Use the  toUTCString() method instead
              toLocaleDateString()  Returns the date portion of a Date object as a string, using locale
                                  conventions

              toLocaleTimeString()  Returns the time portion of a Date object as a string, using locale
                                  conventions
              toLocaleString()    Converts a Date object to a string, using locale conventions

              toString()          Converts a Date object to a string
              toTimeString()      Converts the time portion of a Date object to a string
              toUTCString()       Converts a Date object to a string, according to universal time

              UTC()               Returns the number of milliseconds in a date string since midnight
                                  of January 1, 1970, according  to universal  time
              valueOf()           Returns the primitive value of a Date object



                 Example: How to display a clock on your web page.
                 <html>
                 <head>
                 <script  type=”text/javascript”>
                 function  startTime()
                 {
                 var  today=new  Date();
                 var  h=today.getHours();
                 var  m=today.getMinutes();




                                           LOVELY PROFESSIONAL UNIVERSITY                                   155
   156   157   158   159   160   161   162   163   164   165   166