Re: [Regular expression] Format string to "DD/MM/YYYY hh:mm"

From: Date: Fri, 31 Mar 2006 08:03:16 +0000
Subject: Re: [Regular expression] Format string to "DD/MM/YYYY hh:mm"
References: 1 2 3 4 5  Groups: php.db 
Request: Send a blank email to php-db+get-41647@lists.php.net to get a copy of this message
Balazs Hegedus ha scritto:
<?php
    $date = '30/03/2983 12:00';
    $pattern = '[0-3][0-9]/[0|1][0-9]/[1|2][0-9]{3,3}\s[0-2][0-9]:[0-5][0-9]';
I found this: ^((((([0-1]?\d)|(2[0-8]))\/((0?\d)|(1[0-2])))|(29\/((0?[1,3-9])|(1[0-2])))|(30\/((0?[1,3-9])|(1[0-2])))|(31\/((0?[13578])|(1[0-2]))))\/((19\d{2})|([2-9]\d{3}))|(29\/0?2\/(((([2468][048])|([3579][26]))00)|(((19)|([2-9]\d))(([2468]0)|([02468][48])|([13579][26]))))))\s(([01]?\d)|(2[0-3]))(:[0-5]?\d){2}$ But it accepts second too...can you help me to modify it? bye and thanks anyway, -- Giacomo

« previous php.db (#41647) next »