Published on : August 03, 2020
Title : php.date
Purpose : To format the date and/or a time
Syntax : [php.date p1=’format’ p2=’timestamp’ o.set=’variable name’ /]
Input Parameters :
p1 : Required. Specifies the format of the timestamp
p2 : Optional. Specifies a timestamp. Default is the current date and time
Return Value : Returns a formatted date string on success. FALSE on failure
Example 1 :
Code : [php.date p1=”d_m_Y_h_i_s” o.set=template.current_date_time /]
Output : string(19) “03_08_2020_08_12_07”
Description : It will convert the current date and time (as timestamp is not given) seperated by underscore
Example 2 :
Code : [php.strtotime p1=”April 15 2014 10:30pm” o.set=template.converted_date /]
[php.date p1=”d_m_Y_h_i_s_a” p2=”{template.converted_date}” o.set=template.date_time /]
Output : string(22) “15_04_2014_10_30_00_pm”
Description : It will convert the given timestamp to date and time seperated by underscore