Joomla 日期時間

2023-03-10 15:51 更新

calendar類型顯示一個日歷,以供用戶選擇時間日期。

表現(xiàn)形式

 joomla_calendar.png

字段配置參數(shù)

專屬屬性:

  • type (必填) 必須為 calendar
  • default(可選) 默認(rèn)值。 設(shè)置默認(rèn)的日期。默認(rèn)值的格式必須和參數(shù)設(shè)置中的格式一致。如果需要顯示當(dāng)前日期,可以設(shè)置為“NOW”.同時也支持JDate類的參數(shù)。如:‘now +1 month’ ,‘now +1 day'
  • format(可選) 指定日期的格式。這個是格式將傳遞個PHP去格式化時間。如果沒有指定,則默認(rèn)為'%Y-%m-%d'  輸出 2021-06-10 。如果設(shè)置了showtime 為 true,那么還需要指定時間的格式。如:%Y-%m-%d %H:%M:%S'
  • filter(可選) 用來指定時區(qū)。有兩個可選值 server_utc 或者 user_utc.第一個值使用服務(wù)器的時區(qū),第二個值使用用戶在全局設(shè)置中時區(qū)。
  • translateformate(可選) 如果設(shè)置為true,那么日期將使用 DATE_FORMAT_CALENDAR_DATE 作為語言字符串(showtime 設(shè)置為true時),或者使用DATE_FORMAT_CALENDAR_DATETIME(showtime設(shè)置為false時)。如果本參數(shù)設(shè)置為true,那么foramt參數(shù)將自動失效。
  • showtime(可選) 是否顯示時間。默認(rèn)為false
  • timeformat (可選) 時間的格式??梢再d賬為12 或者24. 當(dāng)設(shè)置為12時,將顯示AM,PM。這個設(shè)置將不會影響時間在數(shù)據(jù)庫中的存儲。
  • singlehead(可選)如果設(shè)置為false,那么年和月的選擇器將分開為兩行。默認(rèn)為false
  • todaybutton(可選)如果設(shè)置為true,將會顯示今天的按鈕。默認(rèn)為true
  • weeknumbers(可選)如果設(shè)置為true,將顯示日期是當(dāng)年的第幾周。默認(rèn)為true
  • filltable(可選)如果設(shè)置為true,將顯示上一個月和下一個月的按鈕,默認(rèn)為true
  • minyear(可選)設(shè)置年份的最小年份,如(-10,2),這個值是相對于當(dāng)前年份的。如果超過這個值得設(shè)置將不能選擇。默認(rèn)為0表示沒有限制
  • maxyear(可選)設(shè)置年份的最小年份,如(-10,2),這個值是相對于當(dāng)前年份的。如果超過這個值得設(shè)置將不能選擇。默認(rèn)為0表示沒有限制

 通用屬性:

  • name (必填)  能代表該字段的唯一的名稱.
  • label (選填) (支持多語言機制) 字段的標(biāo)題
  • description (選填) (支持多語言機制) 該字段的描述信息。當(dāng)鼠標(biāo)移動到標(biāo)簽上面的時候,會以tooltip的形式顯示出來.
  • default (選填) (不支持多語言機制) 默認(rèn)值
  • class (選填) 表單字段的css類名。如果省略,默認(rèn)為'text_area'.
  • required (選填l)  是否必須填寫內(nèi)容,用于在提交表單是進行校驗. ( "true", "1", "readonly"這些都表示true)
  • hint 顯示在html占位符元素中的文本,通常是在空白字段內(nèi)顯示的淺色提示
  • readonly (選填l) 是否只讀,字段的值不能編輯. ("true", "1", "readonly" 這些都表示true)
  • multiple (選填) 是否允許多選(僅對下拉類型有效) (true or false).
  • useglobal (選填) 是否顯示使用全局參數(shù)(僅對支持全局參數(shù)的類型有效) (true or false).
  • disabled (選填) 是否禁用字段。如果為true,那么這個字段的值不能填寫,只能展示 - 并且這個值不會在表單中提交. (可設(shè)置的值: "true", "1", "readonly" 這些都表示true)

使用方法

<field
    name="date"
    type="calendar" <br>        default="NOW"
    label="開始時間"
/>

備注

日期格式表:

CharacterDescriptionExample
dDay of the month, 2 digits with leading zeros01 to 31
aA textual representation of a day, three lettersMon through Sun
eDay of the month without leading zeros1 to 31
AA full textual representation of the day of the weekMonday through Sunday
wNumeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)
jThe day of the year (starting from 0)001 through 366
BA full textual representation of a monthJanuary through December
mNumeric representation of a month, with leading zeros01 through 12
bA short textual representation of a month, three lettersJan through Dec
YA full numeric representation of a year, 4 digits1999 or 2003
yA two-digit representation of a year99 or 03
PLowercase Ante Meridiem or Post Meridiemam or pm
pUppercase Ante Meridiem or Post MeridiemAM or PM


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號