Re: cvs: php4 /pear/Date Calc.php
| From: | Andrei Zmievski | Date: | Mon, 20 Aug 2001 20:36:07 +0000 |
| Subject: | Re: cvs: php4 /pear/Date Calc.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1627@lists.php.net to get a copy of this message | ||
That's pretty English-centric, don't you think?
On Mon, 20 Aug 2001, Yavor Shahpasov wrote:
> yavo Mon Aug 20 16:28:22 2001 EDT
>
> Modified files:
> /php4/pear/Date Calc.php
> Log:
> Added a function getMonthFromFullName to return a month number from a month name.
>
> Index: php4/pear/Date/Calc.php
> diff -u php4/pear/Date/Calc.php:1.11 php4/pear/Date/Calc.php:1.12
> --- php4/pear/Date/Calc.php:1.11 Tue Dec 12 09:58:03 2000
> +++ php4/pear/Date/Calc.php Mon Aug 20 16:28:22 2001
> @@ -1520,7 +1520,30 @@
>
> return substr($weekday_names[$weekday],0,$length);
>
> - } // end func getWeekdayFullname
> + } // end func getWeekdayFullname
> +
> + /**
> + * Returns the numeric month from the month name or an abreviation
> + *
> + * Both August and Aug would return 8
> + *
> + * @param string month name
> + * @return integer month number
> + */
> + function getMonthFromFullName($month){
> + $month = strtolower($month);
> + $months = array("january"=>1, "february"=>2,
> "march"=>3,
> + "april"=>4, "may"=>5,
> "june"=>6,
> + "july"=>7, "august"=>8,
> "september"=>9,
> + "october"=>10, "november"=>11,
> "desember"=>12);
> + while(list($name, $id) = each($months)){
> + if(ereg($month, $name)){
> + return($id);
> + }
> + }
> + return(0);
> + }
> +
>
> } // end class Date_calendar
>
>
>
>
> --
> PEAR CVS Mailing List (http://pear.php.net/)
> To unsubscribe, e-mail: pear-cvs-unsubscribe@lists.php.net
> For additional commands, e-mail: pear-cvs-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
-Andrei
* I don't mind going nowhere as long as it's an interesting path. *