home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / ryosdates.inc < prev    next >
Encoding:
Text File  |  2003-03-16  |  2.4 KB  |  128 lines

  1. <?php
  2. /////////////////////////////////////////////////////////
  3. //    
  4. //    include/ryosdates.inc
  5. //
  6. //    (C)Copyright 2000-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
  7. //
  8. //    This file is part of IlohaMail. IlohaMail is free software released 
  9. //    under the GPL license.  See enclosed file COPYING for details, or 
  10. //    see http://www.fsf.org/copyleft/gpl.html
  11. //
  12. /////////////////////////////////////////////////////////
  13.  
  14. /********************************************************
  15.  
  16.     PURPOSE:
  17.         Miscellaneous date/time related functions, most of which are more or less useless.
  18.         Acts as a place holder for all the dates Ryo never had.
  19.     PRE-CONDITIONS:
  20.         Ryo had no dates
  21.     POST-CONDITIONS:
  22.         Ryo still has no dates
  23.     COMMENTS:
  24.         What, you want me to comment on that?
  25.  
  26. ********************************************************/
  27.  
  28. function GetCurrentMonth(){
  29.     $theTime=time();
  30.     $theDate=getdate($theTime);
  31.     $month=$theDate[mon];
  32.     return $month;
  33. }
  34.  
  35. function GetCurrentDay(){
  36.     $theTime=time();
  37.     $theDate=getdate($theTime);
  38.     $day=$theDate[mday];        
  39.     return $day;
  40. }
  41.  
  42. function GetCurrentYear(){
  43.     $theTime=time();
  44.     $theDate=getdate($theTime);
  45.     $year=$theDate[year];
  46.     return $year;
  47. }
  48.  
  49. function GetCurrentHour(){
  50.     $theTime=time();
  51.     $theDate=getdate($theTime);
  52.     $hour=$theDate[hours];
  53.     return $hour;
  54. }
  55.  
  56. function GetCurrentMinute(){
  57.     $theTime=time();
  58.     $theDate=getdate($theTime);
  59.     $minute=$theDate[minutes];
  60.     return $minute;
  61. }
  62.  
  63. function GetCurrentSeconds(){
  64.     $theTime=time();
  65.     $theDate=getdate($theTime);
  66.     $minute=$theDate[seconds];
  67.     return $minute;
  68. }
  69.  
  70. function GetDateString($mode){
  71.     $theTime=time();
  72.     $theDate=getdate($theTime);
  73.     $year=$theDate[year];
  74.     $month=$theDate[mon];
  75.     $day=$theDate[mday];
  76.     $hour=$theDate[hours];
  77.     $minute=$theDate[minutes];
  78.     return $month;
  79.  
  80.     if ($mode="MMDDYYYY"){
  81.         return $month."-".$day."-".$year;
  82.     }else{
  83.         return "";
  84.     }
  85. }
  86.  
  87. function GetLastDayOfMonth($m){
  88.     if (($m==1)||($m==3)||($m==5)||($m==7)||($m==8)||($m==10)||($m==12)){
  89.         return 31;
  90.     }else if (($m==4)||($m==6)||($m==9)||($m==11)){
  91.         return 30;
  92.     }else if ($m==2){
  93.         $year=GetCurrentYear();
  94.         if (($year%4)!=0)
  95.             return 28;
  96.         else if (($year%4)==0){
  97.             $d=29;
  98.             if (($year%100)==0)
  99.                 $d=28;
  100.             if (($year%400)==0)
  101.                 $d=29;
  102.             return $d;
  103.         }
  104.     }
  105. }
  106.  
  107. function PreviousMonth($m){
  108.     $p=$m-1;
  109.     if ($p==0) $p=12;
  110.     return $p;
  111. }
  112.  
  113. function NextMonth($m){
  114.     $p=$m+1;
  115.     if ($p==13) $p=1;
  116.     return $p;
  117. }
  118.  
  119. function NumToTimeString($i){
  120.     $m=$i % 60;
  121.     $h=($i-$m)/60;
  122.     if ($m<10)
  123.         return $h.":0".$m;
  124.     else
  125.         return $h.":".$m;
  126.  
  127. }
  128. ?>