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

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

 



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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux