|
idate
Format a local time/date as integer
(PHP 5)
Returns a number formatted according to the given format string using the given integer timestamp or the current local time if no timestamp is given. In other words, timestamp is optional and defaults to the value of time(). Unlike the function date(), idate() accepts just one char in the format parameter. Parameters
Return ValuesReturns an integer. As idate() always returns an integer and as they can't start with a "0", idate() may return fewer digits than you would expect. See the example below. Errors/Exceptions
Every call to a date/time function will generate a ExamplesExample 454. idate() example<?php Related Examples ( Source code ) » idate Examples ( Source code ) » Form Data Validation With Error Count Examples ( Source code ) » Login form with Error Messages and Preserving User Input Examples ( Source code ) » Email validation with Regular Expressions Examples ( Source code ) » Define your own exception class Examples ( Source code ) » URL validation by Regular Expression Examples ( Source code ) » Animated Talking Captcha php class Examples ( Source code ) » Feed Validator Examples ( Source code ) » E-mail address validation class Examples ( Source code ) » Extract Email Address from any text Code Examples / Notes » idateqjoe dot sb
To clarify an ambiguity due to the fount: 'I' is a capital i, rather than a miniscule L.
egingell
<? // idate() for PHP < 5 // Sanity check if (!is_callable('idate')) { function idate($char, $ts = false) { if ($ts === false) { $ts = time(); } else if (!is_numeric($ts)) { return false; } $char = $char{0}; if ($char == 'B') { // Swatch time ignores the $ts argument. return ((int) ((gmdate('U') + 3600) * (1000 / 86400))) % 1000; } else { return (int) date($char, $ts); // Drop leading zeroes by casting into an integer. } } } ?> |
Change Languagecheckdate date_create date_date_set date_default_timezone_get date_default_timezone_set date_format date_isodate_set date_modify date_offset_get date_parse date_sun_info date_sunrise date_sunset date_time_set date_timezone_get date_timezone_set date getdate gettimeofday gmdate gmmktime gmstrftime idate localtime microtime mktime strftime strptime strtotime time timezone_abbreviations_list timezone_identifiers_list timezone_name_from_abbr timezone_name_get timezone_offset_get timezone_open timezone_transitions_get |