Date Helper
The Date Helper document contains capacities that help with working with dates.
- Stacking this Helper
- Accessible Functions
Stacking this Helper
This aide is stacked utilizing the accompanying code:
helper('date');
Accessible Functions
The accompanying capacities are accessible:
now([$timezone = NULL])
Parameters:
$timezone (string) – Timezone
Returns:
UNIX timestamp
Bring type back:
int
Returns the present time as a UNIX timestamp, referenced either to your server's neighborhood time or any PHP upheld timezone, in view of the "time reference" setting in your config document. On the off chance that you don't expect to set your lord time reference to some other PHP upheld timezone (which you'll normally do on the off chance that you run a site that lets every client set their own timezone settings) there is no advantage to utilizing this capacity over PHP's time() work.
reverberation now('Australia/Victoria');
In the event that a timezone isn't given, it will return time() in light of the time_reference setting.
timezone_select([$class = '', $default = '', $what = DateTimeZone::ALL, $country = null])
Parameters:
$class (string) – Optional class to apply to the select field
$default (string) – Default an incentive for starting determination
$what (int) – DateTimeZone class constants (see listIdentifiers)
$country (string) –
A two-letter ISO 3166-1 good nation code (see listIdentifiers)
Returns:
Preformatted HTML select field
Bring type back:
string
Creates a select structure field of accessible timezones (alternatively separated by $what and $country). You can supply a choice class to apply to the field to make designing simpler, just as a default chosen esteem.
reverberation
echo timezone_select('custom-select', 'America/New_York');
Numerous capacities recently found in the CodeIgniter 3 date_helper have been moved to the I18n module in CodeIgniter 4.