国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

directory search
Array Array Helper Benchmarking Benchmarking Class Caching Caching Driver Calendaring Calendaring Class CAPTCHA CAPTCHA Helper Config Config Class Cookie Cookie Helper Database Connecting to your Database Custom Function Calls Database Caching Class Database Configuration Database Forge Class Database Metadata Database Quick Start: Example Code Database Reference Database Utility Class DB Driver Reference Generating Query Results Queries Query Builder Class Query Helper Methods Transactions Date Date Helper Directory Directory Helper Download Download Helper Email Email Class Email Helper Encrypt Encrypt Class Encryption Encryption Library File File Helper File Uploading File Uploading Class Form Form Helper Form Validation Form Validation FTP FTP Class Functions compatibility_functions common_functions HTML HTML Helper HTML Table HTML Table Class Image Manipulation Image Manipulation Class Inflector Inflector Helper Input Input Class Javascript Javascript Class Language Language Class Language Helper Loader Loader Class Migrations Migrations Class Number Number Helper Output Output Class Pagination Pagination Class Path Path Helper Security Security Class Security Helper Session Session Library Shopping Cart Shopping Cart Class Smiley Smiley Helper String String Helper Template Parser Template Parser Class Text Text Helper Trackback Trackback Class Typography Typography Class Typography Helper Unit Testing Unit Testing Class URI URL User Agent XML XML-RPC and XML-RPC Server Zip Encoding Zip Encoding Class XML-RPC and XML-RPC Server Classes XML Helper User Agent Class URL Helper URI Class
characters

Date Helper文件包含幫助您處理日期的函數(shù)。

  • 加載此助手

  • 可用職能

  • 時區(qū)參考

加載此助手

使用以下代碼加載此助手:

$this->load->helper('date');

可用職能

現(xiàn)有下列職能:

now([$timezone = NULL])

參數(shù):

$ timezone(字符串) - 時區(qū)

返回:

UNIX時間戳

返回類型:

INT

  • $ timezonestring) - 時區(qū)返回:UNIX時間戳返回類型:int根據(jù)您的配置文件中的“時間參考”設置,將當前時間作為UNIX時間戳返回,根據(jù)服務器本地時間或任何PHP支持的時區(qū)。如果您不打算將您的主時間參考設置為任何其他PHP支持的時區(qū)(如果您運行的網(wǎng)站允許每個用戶設置自己的時區(qū)設置,您通常會這樣做),但使用PHP time()函數(shù)的此功能沒有任何好處。現(xiàn)在回聲('澳大利亞/維多利亞'); 如果未提供時區(qū),它將time()根據(jù)time_reference設置返回。mdate([$datestr = ''[, $time = '']])參數(shù):$ datestr(string) - 日期字符串$ time(int) -  UNIX timestampReturns:MySQL格式的dateReturn類型:string

  • $ datestr字符串) - 日期字符串

  • $ timeint) -  UNIX時間戳

返回:MySQL格式的日期
返回類型:字符串
該函數(shù)與PHP的[date()](https://php.net/manual/en/function.date.php)函數(shù)相同,不同的是它允許使用MySQL風格日期代碼,其中每個代碼字母都以百分號,例如`%Y%m%d`

以這種方式進行日期的好處是,您不必擔心會轉(zhuǎn)義任何不是日期代碼的字符,因為您通常需要處理該date()函數(shù)。

例子:

$ datestring ='年:%Y月:%m日:%d  - %h:%i%a'; $ time = time(); 回聲mdate($日期字符串,$時間);

如果時間戳未包含在第二個參數(shù)中,則將使用當前時間。

standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]])

參數(shù):

$ fmt(字符串) - 日期格式$ time(int) -  UNIX時間戳

返回:

格式化日期或FALSE格式無效

返回類型:

  • $ fmt字符串) - 日期格式

  • $ timeint) -  UNIX時間戳

Returns:  Formatted date or FALSE on invalid format
Return type:  string
Lets you generate a date string in one of several standardized formats.

例子:

$ format ='DATE_RFC822'; $ time = time(); echo standard_date($ format,$ time);

這一功能已被廢棄。使用本機date()結(jié)合日期時間格式常數(shù)相反:

回聲日期(DATE_RFC822,time());

支持格式:

Constant Description Example    DATE\_ATOM Atom 2005-08-15T16:13:03+0000   DATE\_COOKIE HTTP Cookies Sun, 14 Aug 2005 16:13:03 UTC   DATE\_ISO8601 ISO-8601 2005-08-14T16:13:03+00:00   DATE\_RFC822 RFC 822 Sun, 14 Aug 05 16:13:03 UTC   DATE\_RFC850 RFC 850 Sunday, 14-Aug-05 16:13:03 UTC   DATE\_RFC1036 RFC 1036 Sunday, 14-Aug-05 16:13:03 UTC   DATE\_RFC1123 RFC 1123 Sun, 14 Aug 2005 16:13:03 UTC   DATE\_RFC2822 RFC 2822 Sun, 14 Aug 2005 16:13:03 +0000   DATE\_RSS RSS Sun, 14 Aug 2005 16:13:03 UTC   DATE\_W3C W3C 2005-08-14T16:13:03+0000

local_to_gmt([$time = ''])

參數(shù):

$ time(int) -  UNIX時間戳

返回:

UNIX時間戳

返回類型:

INT

  • $ timeint) -  UNIX時間戳記返回:UNIX時間戳記返回類型:int將UNIX時間戳記作為輸入并將其作為GMT返回。例如:$ gmt = local_to_gmt(time()); gmt_to_local([$time = ''[, $timezone = 'UTC'[, $dst = FALSE]]])參數(shù):$ time(int) -  UNIX時間戳$ timezone(字符串) - 時區(qū)$ dst(bool) -  DST是否為activeReturns:UNIX timestamp返回類型:int

  • $ timeint) -  UNIX時間戳

  • $ timezone字符串) - 時區(qū)

  • $ dstbool) -  DST是否處于活動狀態(tài)

Returns:  UNIX timestamp
Return type:  int
Takes a UNIX timestamp (referenced to GMT) as input, and converts it to a localized timestamp based on the timezone and Daylight Saving Time submitted.

例子:

$ timestamp = 1140153693; $ timezone ='UM8'; $ daylight_saving = TRUE; echo gmt_to_local($ timestamp,$ timezone,$ daylight_saving);

有關(guān)時區(qū)的列表,請參閱本頁底部的引用。

mysql_to_unix([$time = ''])

參數(shù):

$ time(string) -  MySQL時間戳

返回:

UNIX時間戳

返回類型:

INT

  • $ timestring) -  MySQL時間戳記返回:UNIX時間戳記返回類型:int將MySQL時間戳記作為輸入并將其作為UNIX時間戳記返回。例如:$ unix = mysql_to_unix('20061124092345'); unix_to_human([$time = ''[, $seconds = FALSE[, $fmt = 'us']]])參數(shù):$ time(int) -  UNIX時間戳$ seconds(bool) - 是否顯示秒數(shù)$ fmt(string) -  format(us或euro)返回:格式化dateReturn類型:string

  • $ timeint) -  UNIX時間戳

  • $秒布爾) - 是否顯示秒

  • $ fmt字符串) - 格式(美元或歐元)

Returns:  Formatted date
Return type:  string
Takes a UNIX timestamp as input and returns it in a human readable format with this prototype:

YYYYY-MM-DD HH:mm:SS AM/PM

如果您需要在表單字段中顯示日期以供提交,這可能非常有用。

時間可以用秒來格式化,也可以設置為歐洲或美國格式。如果只提交時間戳,它將在沒有秒的情況下返回美國格式的時間。

例子:

$ now = time(); echo unix_to_human($ now); // US time,no seconds echo unix_to_human($ now,TRUE,'us'); //美國時間秒鐘回顯unix_to_human($ now,TRUE,'eu'); //秒數(shù)的歐元時間

human_to_unix([$datestr = ''])

參數(shù):

$ datestr(int) - 日期字符串

返回:

UNIX時間戳或FALSE失敗

返回類型:

INT

  • $ datestrint) - 日期字符串返回:UNIX時間戳或失敗時的FALSE返回類型:int與unix_to_time()函數(shù)相反。將“人類”時間作為輸入并將其作為UNIX時間戳返回。如果您接受通過表單提交的“人”格式的日期,這很有用。返回布爾型傳遞給它的FALSE日期字符串沒有按照上面的說明格式化。例如:$ now = time(); $ human = unix_to_human($ now); $ unix = human_to_unix($ human); nice_date([$bad_date = ''[, $format = FALSE]])參數(shù):$ bad_date(int) - 非常格式化的類日期字符串$ format(string) - 要返回的日期格式(與PHP的date()函數(shù)相同)返回:格式化dateReturn類型:string

  • $ bad_dateint) - 非常格式化的類似日期的字符串

  • $ formatstring) - 返回的日期格式(與PHP date()函數(shù)相同)

Returns:  Formatted date
Return type:  string
This function can take a number poorly-formed date formats and convert them into something useful. It also accepts well-formed dates.

該函數(shù)默認返回一個UNIX時間戳。您可以選擇傳遞格式字符串(與PHP date()函數(shù)接受的類型相同)作為第二個參數(shù)。

例子:

$ bad_date ='199605'; //產(chǎn)生:1996-05-01 $ better_date = nice_date($ bad_date,'Ym-d'); $ bad_date ='9-11-2001'; //產(chǎn)生:2001-09-11 $ better_date = nice_date($ bad_date,'Ym-d');

這個函數(shù)被廢棄了。日期時間類相反。

timespan([$seconds = 1[, $time = ''[, $units = '']]])

參數(shù):

$ seconds(int) - 秒數(shù)$ time(字符串) -  UNIX時間戳$ units(int) - 要顯示的時間單位數(shù)

返回:

格式化時差

返回類型:

  • $ secondsint) - 秒數(shù)

  • $ time字符串) -  UNIX時間戳

  • $ unitsint) - 要顯示的時間單位數(shù)

Returns:  Formatted time difference
Return type:  string
Formats a UNIX timestamp so that is appears similar to this:

1年10個月2周5天10小時16分鐘

第一個參數(shù)必須包含UNIX時間戳。第二個參數(shù)必須包含比第一個時間戳更大的時間戳。第三個參數(shù)是可選的,并限制顯示時間單位的數(shù)量。

如果第二個參數(shù)為空,則將使用當前時間。

此函數(shù)最常見的目的是顯示從過去某個時間點到現(xiàn)在已經(jīng)過去了多長時間。

例子:

$ post_date ='1079621429'; $ now = time(); $ units = 2; 回聲時間范圍($ post_date,$ now,$ units);

此函數(shù)生成的文本位于以下語言文件中:language/<your_lang>/date_lang.php

days_in_month([$month = 0[, $year = '']])

參數(shù):

$ month(int) - 數(shù)字月份$ year(int) - 數(shù)字年份

返回:

指定月份中的天數(shù)

返回類型:

INT

  • $ monthint) - 數(shù)字月份

  • $ yearint) - 一個數(shù)字年份

Returns:  Count of days in the specified month
Return type:  int
Returns the number of days in a given month/year. Takes leap years into account.

例子:

echo days_in_month(06,2005);

如果第二個參數(shù)為空,則將使用當前年份。

此函數(shù)將別名本機cal_days_in_month(),如果可以的話。

date_range([$unix_start = ''[, $mixed = ''[, $is_unix = TRUE[, $format = 'Y-m-d']]]])

參數(shù):

$ unix_start(int) - 范圍開始日期的UNIX時間戳$ mixed(int) - 范圍結(jié)束日期或時間間隔的UNIX時間戳(以天為單位)$ is_unix(bool) - 如果$ mixed不是時間戳記,則設置為FALSE $ format ) - 輸出日期格式與日期()中的相同

返回:

一組日期

返回類型:

排列

  • $ unix_startint) - 范圍開始日期的UNIX時間戳

  • $ mixedint) - 范圍結(jié)束日期或間隔的UNIX時間戳,以天為單位

  • $ is_unixbool) - 如果$ mixed不是時間戳,則設置為FALSE

  • $ formatstring) - 輸出日期格式,與in相同date()

Returns:  An array of dates
Return type:  array
Returns a list of dates within a specified period.

例子:

$ range = date_range('2012-01-01','2012-01-15'); 回聲“2012年前15天:”; foreach($ range as $ date){echo $ date?!癨 n”; }

timezones([$tz = ''])

參數(shù):

$ tz(字符串) - 一個數(shù)字時區(qū)

返回:

與UTC的小時差異

返回類型:

INT

  • $ tzstring) - 數(shù)字時區(qū)返回:與UTC的小時差值返回類型:int獲取時區(qū)參考(有效時區(qū)列表,請參見下面的“時區(qū)參考”),并返回與UTC時差的小時數(shù)。例如:回聲時區(qū)('UM5'); 使用此功能時非常有用timezone_menu()。timezone_menu([$default = 'UTC'[, $class = ''[, $name = 'timezones'[, $attributes = '']]]])參數(shù):$ default(string) -  Timezone $ class(string) - 類名稱$ name(string) - 菜單名稱$ attributes(mixed) -  HTML屬性返回:帶時區(qū)的HTML下拉菜單返回類型:字符串

  • $ defaultstring) - 時區(qū)

  • $ classstring) - 類名

  • $ name字符串) - 菜單名稱

  • $ attributesmixed) -  HTML屬性

Returns:  HTML drop down menu with time zones
Return type:  string
Generates a pull-down menu of timezones, like this one:

(UTC -12:00)貝克/豪蘭島(UTC -11:00)紐埃島薩摩亞時區(qū)(UTC -10:00)塔希提島庫克群島夏威夷阿留申標準時間(UTC -9:30)馬克薩斯群島UTC -9:00)阿拉斯加標準時間,甘比爾群島(UTC -8:00)太平洋標準時間,克利珀頓島(UTC -7:00)山區(qū)標準時間(UTC -6:00)中部標準時間(UTC -5: 00)東部標準時間,西加勒比海標準時間(UTC -4:30)委內(nèi)瑞拉標準時間(UTC -4:00)大西洋標準時間,東加勒比標準時間(UTC -3:30)紐芬蘭標準時間(UTC -3: 00)阿根廷,巴西,法屬圭亞那,烏拉圭(UTC -2:00)南佐治亞/南桑威奇群島(UTC -1:00)亞速爾群島,佛得角群島(UTC)格林尼治標準時間,西歐時間(UTC +1: 00)中歐時間,西非時間(UTC +2:00)中非時間,東歐時間,加里寧格勒時間(UTC +3:00)莫斯科時間,東非時間(UTC +3:30)伊朗標準時間(UTC +4:00)阿塞拜疆標準時間,薩馬拉時間(UTC +4:30)阿富汗(UTC +5孟加拉國標準時間,葉卡捷琳堡時間(UTC +5:30)印度標準時間,斯里蘭卡時間(UTC +5:45)尼泊爾時間(UTC +6:00)孟加拉國標準時間,不丹時間,鄂木斯克時間(UTC +6:30)科科斯群島,緬甸(UTC +7:00)克拉斯諾亞爾斯克時間,柬埔寨,老撾,泰國,越南(UTC +8:00)澳大利亞西部標準時間,北京時間,伊爾庫茨克時間(UTC +8:45)澳大利亞中部標準時間(UTC +9:00)日本標準時間,韓國標準時間,雅庫茨克時間(UTC +9:30)澳大利亞中部標準時間(UTC +10:00)澳大利亞東部標準時間,符拉迪沃斯托克時間(UTC + 10:30)豪勛爵島(UTC +11:00)Srednekolymsk時間,所羅門群島,瓦努阿圖(UTC +11:30)諾福克島(UTC +12:00)斐濟,吉爾伯特群島,堪察加時間,新西蘭標準時間(UTC +12:45)查塔姆群島標準時間(UTC +13:00)鳳凰城時間,湯加(UTC +14 :00)Line Islands如果您運行允許用戶設置其本地時區(qū)值的成員資格網(wǎng)站,則此菜單很有用。

第一個參數(shù)允許您設置菜單的“選定”狀態(tài)。例如,要將太平洋時間設置為默認設置,您將執(zhí)行以下操作:

echo timezone_menu('UM8');

請參閱下面的時區(qū)引用,以查看此菜單的值。

第二個參數(shù)允許您為菜單設置CSS類名。

第四個參數(shù)允許您在生成的SELECT標記上設置一個或多個屬性。

菜單中包含的文本位于以下語言文件中:language/<your_lang>/date_lang.php

時區(qū)參考

下表指出每個時區(qū)及其位置。

注意,為了清晰和格式化,一些位置列表已經(jīng)被刪減。

時區(qū)

位置

UM12

(UTC  -  12:00)貝克/豪蘭島

UM11

(UTC  -  11:00)紐埃薩摩亞時區(qū)

M10

(UTC  -  10:00)庫克群島夏威夷阿留申標準時間

UM95

(UTC  -  09:30)馬克薩斯群島

UM9

(UTC  -  09:00)阿拉斯加標準時間,甘比爾群島

UM8

(UTC  -  08:00)太平洋標準時間,克利珀頓島

UM7

(UTC  -  07:00)標準時間

UM6

(UTC  -  06:00)中部標準時間

UM5

(UTC  -  05:00)西加勒比海東部標準時間

UM45

(UTC  -  04:30)委內(nèi)瑞拉標準時間

UM4

(UTC  -  04:00)大西洋標準時間,東加勒比地區(qū)

UM35

(UTC  -  03:30)紐芬蘭標準時間

UM3

(UTC  -  03:00)阿根廷,巴西,法屬圭亞那,烏拉圭

UM2

(UTC  -  02:00)南喬治亞/南桑威奇群島

UM1

(UTC -1:00)佛得角群島亞速爾群島

世界標準時間

(UTC)格林尼治標準時間,西歐時間

UP1

(UTC +1:00)中歐時間,西非時間

UP2

(UTC +2:00)中部非洲時間,東歐時間

UP3

(UTC +3:00)莫斯科時間,東非時間

UP35

(UTC +3:30)伊朗標準時間

UP4

(UTC +4:00)阿塞拜疆標準時間,薩馬拉時間

UP45

(UTC +4:30)阿富汗

UP5

(UTC +5:00)巴基斯坦標準時間,葉卡捷琳堡時間

UP55

(UTC +5:30)印度標準時間,斯里蘭卡時間

UP575

(UTC +5:45)尼泊爾時間

UP6

(UTC +6:00)孟加拉國標準時間,不丹時間,鄂木斯克時間

UP65

(UTC +6:30)緬甸科科斯群島

UP7

(UTC +7:00)克拉斯諾亞爾斯克時間,柬埔寨,老撾,泰國,越南

UP8

(UTC +8:00)澳大利亞西部標準時間,北京時間

UP875

(UTC +8:45)澳大利亞中西部標準時間

UP9

(UTC +9:00)日本標準時間,韓國標準時間,雅庫茨克

UP95

(UTC +9:30)澳大利亞中部標準時間

UP10

(UTC +10:00)澳大利亞東部標準時間,符拉迪沃斯托克時間

UP105

(UTC +10:30)豪勛爵島

UP11

(UTC +11:00)中科雷姆斯克時間,所羅門群島,瓦努阿圖

UP115

(UTC +11:30)諾??藣u

UP12

(UTC +12:00)斐濟,吉爾伯特群島,新西蘭堪察加

UP1275

(UTC +12:45)查塔姆群島標準時間

UP13

(UTC +13:00)鳳凰島時間,湯加

UP14

(UTC +14:00)線路島

Previous article: Next article: