home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 June / MacHome Magazine Demo Disc June 2001.iso / Stuff / Software / Graphic / PageSpinner 3.0.2 / Includes / time.js < prev   
Encoding:
Text File  |  2000-08-07  |  1.5 KB  |  71 lines  |  [TEXT/JyWs]

  1. <SCRIPT LANGUAGE="JavaScript" type="text/javascript">
  2. <!--
  3.  
  4. // ********************************************************
  5.     time.js
  6.  
  7.     Time and date utilites in JavaScript.
  8.  
  9.     Included in  the PageSpinner distribution.
  10.     Copyright Optima System, 1997.
  11.  
  12.     This is an example of how to use PageSpinner Includes
  13.     files that contains JavaScript.
  14.  
  15.     We will not be held responsible for any unwanted 
  16.     effects due to the usage of this script or any derivative.
  17.     No warrantees for usability for any specific application 
  18.     are given or implied.
  19.  
  20.     You are free to use and modify these scripts
  21.     if the credit above is included.
  22. // ********************************************************
  23.  
  24. // getTime()
  25. // Returns: Text containing the time in the format HH:MM
  26.  
  27. function getTime()
  28. {       
  29.     var now = new Date();
  30.     var minutes = now.getMinutes();
  31.     var divider = ":";
  32.  
  33.     if (minutes<10)
  34.         divider = ":0";
  35.  
  36.     return( now.getHours() + divider + minutes );
  37. }
  38.  
  39. function showBetween (theText, altText, startAt, stopAt)
  40. {
  41.     var now = new Date();
  42.     var h = now.getHours();
  43.  
  44.     if (startAt <= stopAt)
  45.     {
  46.         if ( h >= startAt & h <= stopAt)
  47.             return(theText)
  48.         else
  49.             return (altText);
  50.     }
  51.     return ('** ERROR in JavaScript showBetween **');
  52. }
  53.  
  54. function showBetween (theText, altText, startAt, stopAt)
  55. {
  56.     var now = new Date();
  57.     var h = now.getHours();
  58.  
  59.     if (startAt <= stopAt)
  60.     {
  61.         if ( h >= startAt & h <= stopAt)
  62.             return(theText)
  63.         else
  64.             return (altText);
  65.     }
  66.     return ('** ERROR in JavaScript showBetween **');
  67. }
  68.  
  69. // -->
  70. </SCRIPT>
  71.