CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 PHP - Complete Validation of 24 hr time (cannot be 23:66)

Print topic Send  topic

Author Message

Posts: 618
Posted: 12/26/2014, 4:02 PM

In noticed that with date format dd/mm/yy H:nn that validation will accept times greater than 23:59

Not sure if I am missing a feature in CCS which will enforce upper limit of 23:59, so this is the answer:

$breakstart = CCFormatDate($recordtimesheetlineitem->breakstart->GetValue(), array("dd", "/", "mm", "/", "yy", " ", "H", ":", "nn"));

list($day, $month, $year, $hour, $minute) = split('[/ :]', $breakstart);
$breakstart = mktime($hour, $minute, 0, $month, $day, $year);

if(($hour > 23) or ($minute > 59)){
$recordtimesheetlineitem1->Errors->addError("Break Start Time format must be 24 hr.");

Due to varying numbers of days in calendar months I recommend allowing the CCS validation to handle day, month and year as it does this effectively.
Central Coast, NSW, Australia.

Use the EXETA Online Business Valuation Tool to
value your business.
View profile  Send private message

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Web Database

Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.