Helper::convertDate2NHS PHP Method

convertDate2NHS() public static method

Strings that do not return a valid date return $empty_string.
public static convertDate2NHS ( string $value, string $empty_string = '-' ) : string
$value string
$empty_string string
return string
    public static function convertDate2NHS($value, $empty_string = '-')
    {
        $time = strtotime($value);
        if ($time) {
            return date(self::NHS_DATE_FORMAT, $time);
        } else {
            return $empty_string;
        }
    }

Usage Example

    ?>
			<span id="<?php 
    echo $side;
    ?>
_sft_history_icon" class="sft-history-icon">
				<img src="<?php 
    echo $this->assetPath;
    ?>
/img/icon_info.png" style="height:20px" />
			</span>
			<div class="quicklook sft-history" style="display: none;">
				<?php 
    echo '<b>Previous SFT Measurements</b><br />';
    echo '<dl style="margin-top: 0px; margin-bottom: 2px;">';
    foreach ($past_sft as $previous) {
        echo '<dt>' . Helper::convertDate2NHS($previous['date']) . ' - ' . $previous['sft'] . '&micro;m</dt>';
    }
    echo '</dl>';
    ?>
			</div>
		<?php 
}
?>
	</div>
</div>

<?php 
echo $form->radioBoolean($element, $side . '_thickness_increase', array(), array('label' => 4, 'field' => 8));
echo $form->radioBoolean($element, $side . '_dry', array(), array('label' => 4, 'field' => 8));
?>
All Usage Examples Of Helper::convertDate2NHS