![]() ![]() ![]() If you don't pass a timezone, the timezone set on the current Date object will be used when formatting the result. This method uses patterns for the strftime()įunction instead of date() to allow for i18n. Patterns are defined in the fuel/core/config/date.php config file - you can add your ownīy creating a similar file in app/config. The format method returns a formatted date as specified by the pattern key. if none is specified, the largest possible is returnedĮcho Date::time_ago(strtotime("01 January 2012")) // 1 months ago (when in February 2012)Įcho Date::time_ago(strtotime("12 April 1964"), strtotime("01 March 2012")) // 5 decades agoĮcho Date::time_ago(strtotime("12 April 1964"), strtotime("01 March 2012"), 'year') // 48 years agoįormat($pattern_key = 'local', $timezone = null) Possible values are 'second', 'minute', 'hour', 'day', 'week', 'month', 'year' and 'decade'. If not given or null, use the current time The time_ago method returns a formatted time difference. The year to use (defaults to current year) The days_in_month returns the number of days in any given month, in the year specified Static Print_r(Date::range_to_array($start, $end, "+2 days")) The interval at which to create a Date object The end date either as a Date object or a timestamp The start date either as a Date object or a timestamp The range_to_array converts a range of dates into an array of date objects Static Range_to_array($start, $end, $interval = '+1 Day') Print_r(Date::create_from_string("", "us")) The pattern key to use (see config/date.php) or directly a strptime() pattern Is used instead and the pattern is ignored. That method isn't available on Windows hosts however, on those strtotime() The create_from_string creates a Date object from a named date string format or aįor i18n purposes. set the display timezone to 'America/Lima'Ĭreate_from_string($input, $pattern_key = 'local') Mixed, null, or the current display timezone if no parameter is passed. The display timezone to be used to format timestamps in a non-system timezone. If you don't pass a parameter, the current display_timezone is returned. The display_timezone method allows you to globally set a timezone which can be usedīy the format() method to generate output in another timezone then the system timezone. The time method returns the current time in the given timezone as a Date object. The forge method returns a new date object. forge($timestamp = null, $timezone = null) You can also use the Date class for timezone conversions. The Date class is a set of helper functions for working with dates, contrary to PHP's DateTime class theįuel Date class has full support for i18n.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |