| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZDateUtils class 4 // 5 // Created on: <05-May-2004 11:51:15 amos> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 /*! \file ezdateutils.php 30 */ 31 32 /*! 33 \class eZDateUtils ezdateutils.php 34 \brief The class eZDateUtils does 35 36 */ 37 38 class eZDateUtils 39 { 40 /*! 41 Constructor 42 */ 43 function eZDateUtils() 44 { 45 } 46 47 /*! 48 \static 49 Return a textual representation of the date according to the RFC 1123 standard. 50 51 rfc1123-date = wkday "," SP date1 SP time SP "GMT" 52 date1 = 2DIGIT SP month SP 4DIGIT 53 ; day month year (e.g., 02 Jun 1982) 54 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT 55 ; 00:00:00 - 23:59:59 56 wkday = "Mon" | "Tue" | "Wed" 57 | "Thu" | "Fri" | "Sat" | "Sun" 58 month = "Jan" | "Feb" | "Mar" | "Apr" 59 | "May" | "Jun" | "Jul" | "Aug" 60 | "Sep" | "Oct" | "Nov" | "Dec" 61 */ 62 function rfc1123Date( $timestamp = false ) 63 { 64 if ( $timestamp === false ) 65 $timestamp = mktime(); 66 $wday = (int) gmdate( 'w', $timestamp ); 67 $days = array( 1 => 'Mon', 2 => 'Tue', 3 => 'Wed', 68 4 => 'Thu', 5 => 'Fri', 6 => 'Sat', 0 => 'Sun' ); 69 $wkday = $days[$wday]; 70 $month = (int) gmdate( 'n', $timestamp ); 71 $months = array( 1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 72 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 73 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec' ); 74 75 $mon = $months[$month]; 76 return gmstrftime( $wkday . ", %d " . $mon . " %Y %H:%M:%S" . " GMT", $timestamp ); 77 } 78 79 /*! 80 \static 81 Return a textual representation of the date according to the RFC 850 standard. 82 83 rfc850-date = weekday "," SP date2 SP time SP "GMT" 84 date2 = 2DIGIT "-" month "-" 2DIGIT 85 ; day-month-year (e.g., 02-Jun-82) 86 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT 87 ; 00:00:00 - 23:59:59 88 wkday = "Mon" | "Tue" | "Wed" 89 | "Thu" | "Fri" | "Sat" | "Sun" 90 weekday = "Monday" | "Tuesday" | "Wednesday" 91 | "Thursday" | "Friday" | "Saturday" | "Sunday" 92 month = "Jan" | "Feb" | "Mar" | "Apr" 93 | "May" | "Jun" | "Jul" | "Aug" 94 | "Sep" | "Oct" | "Nov" | "Dec" 95 */ 96 function rfc850Date( $timestamp = false ) 97 { 98 if ( $timestamp === false ) 99 $timestamp = mktime(); 100 $wday = (int) gmdate( 'w', $timestamp ); 101 $days = array( 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 102 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday', 0 => 'Sunday' ); 103 $weekday = $days[$wday]; 104 $month = (int) gmdate( 'n', $timestamp ); 105 $months = array( 1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 106 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 107 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec' ); 108 $mon = $months[$month]; 109 return gmstrftime( $weekday . ", %d-" . $mon . "-%Y %H:%M:%S" . " GMT", $timestamp ); 110 } 111 112 /*! 113 \static 114 Parses the date \a $dateText which is in text format and returns a timestamp which represents that date. 115 */ 116 function textToDate( $dateText ) 117 { 118 return strtotime( $dateText ); 119 } 120 } 121 122 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |