MichaelMcDonald
Posts: 640
|
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.
|