Re: regular expression for time

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

 



Hello babu,

Monday, August 29, 2005, 6:50:32 AM, you wrote:
> how can i write regular expression for time in 24-hour format i:e,
> HH:MM:SS. using preg_match.

<?php
$xtime="19:59:53";
if (preg_match("/([01][0-9]|[2][0-3]):[0-5][0-9]:[0-5][0-9]/", $xtime))
  echo "Good";
else
  echo "Bad";
?>


--                        TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B
 __    ____  ____  ____   Geocaching:                    http://gps.PCWize.com
(  )  ( ___)(_  _)( ___)  TBUDP Wiki Site:  http://www.PCWize.com/thebat/tbudp
 )(__  )__)  _)(_  )__)   Roguemoticons & Smileys:    http://PCWize.com/thebat
(____)(____)(____)(__)    PHP Tutorials and snippets:    http://www.DevTek.org

Save your pennies.  The dollars go to the I.R.S.

-- 
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