Re: localize string (date)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Its either ur title is misleading or I'm misunderstanding
is this what u want?

$subject = "21-05-2010 Ideo urbs Venerabile superb post 12-02-2010
efferatarum latasque 12-02-10 leges gentium cervicis oppressed and
fundamenta libertatis retinacula sempiterne Frugi velut parens and
prudent and dives Caesaribus tamquam 25-04-2010 liberis am regendi
patrimonii swore permitted21-05-2010";
$dateReg = '/[\D]\d{2}[.-]\d{2}[.-](\d{2}|\d{4})[\D]/';
preg_match_all($dateReg, ' '. $subject . ' ', $match);
array_walk($match[0], 'myGetDate');
var_dump($match[0], 1);
function myGetDate(&$str)
{
	$str = substr($str, 1, strlen($str) - 2);
}

On Fri, May 21, 2010 at 3:12 PM, Mickael MONSIEUR
<mickael.monsieur@xxxxxxxxx> wrote:
> Le 21/05/10 21:00, Ashley Sheridan a écrit :
>>
>> On Fri, 2010-05-21 at 20:51 +0200, Mickael MONSIEUR wrote:
>>>
>>> hello
>>> I want to find a date in a text how to? format: XX-XX-XXXX
>>>
>>> Example:
>>>
>>> Ideo urbs Venerabile superb post 12-02-2010 efferatarum latasque leges
>>> gentium cervicis oppressed and fundamenta libertatis retinacula
>>> sempiterne Frugi velut parens and prudent and dives Caesaribus tamquam
>>> 25-04-2010 liberis am regendi patrimonii swore permitted.
>>>
>>> Return:
>>>
>>> 12-12-2010
>>> 25-04-2010
>>>
>>> Thank you for your help.
>>> Mickael.
>>>
>>
>> What sort of format is that date, English or American?
>>
>> For example: dd-mm-yyyy or mm-dd-yyyy?
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
> Hi,
>
> The principle is to detect the possible dates in French texts.
>
> The formats can be varied ...
>
> examples
> 02.12.1991, 02/12/1991, 12-02-1991, ... or 2 digit (max 1 char ./-) 2 digit
> (max 1 char ./- ) 4 OR 2 digit (1991 Or 91) :-)
>
> Br,
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux