Skip to content

Commit

Permalink
Added the new functions for setDay,setYear,setHour,setMinute,setSecon…
Browse files Browse the repository at this point in the history
…d,setMonth.
  • Loading branch information
Dharcf committed Dec 30, 2024
1 parent ee6904a commit c83d4dc
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 0 deletions.
38 changes: 38 additions & 0 deletions data/en/setday.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "setDay",
"type": "function",
"syntax": "date.setDay(number)",
"returns": "date",
"related": ["SetMonth","SetYear","SetHour","SetMinute","SetSecond"],
"description": "Sets the day for the Date object.",
"params": [
{
"name":"number",
"description":"The number of datepart units to add to the provided date.\n Number must be an integer.\n Negative integers move the date into the past, positive into the future.",
"required":true,
"default":"",
"type":"numeric",
"values":[]
},
{
"name":"date",
"description":"A datetime object in the range of 100AD-9999AD.\n\r NOTE: When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object.",
"required":true,
"default":"",
"type":"date",
"values":[]
}
],
"engines": {
"coldfusion": {"minimum_version":"", "notes":"Member function is available in CF18+.", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/setday.html"}
},
"examples":[
{"title":"Set Day to a Date", "description":"Sets the day on the Date object.", "code":"<cfset myday = now()>\n<cfoutput>#myday.setday(15)#</cfoutput>"},
{"title":"Set Day to a Date", "description":"Sets the day on the Date object.", "code":"<cfset myday = '01/30/2024'>\n<cfoutput>#myday.setday(15)#</cfoutput>","result":"{ts '2024-01-15 00:00:00'}"}
],
"links": []
}




34 changes: 34 additions & 0 deletions data/en/sethour.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name":"setHour",
"type":"function",
"syntax":"date.SetHour(number)",
"return":"date",
"related":["setDay","SetMonth","SetYear","SetMinute","SetSecond"],
"description":"Sets the hour on the Date object.",
"params":[
{
"name":"number",
"description":"Number representing the hour.\n\r Number must be an integer.\r\n\nExpected values are 0-23, but other values are allowed:\r\n* -1 results in the last hour of the previous day.\r\n * 24 results in the first hour of the next day",
"required":true,
"default":"",
"type":"numeric",
"values":[]
},
{
"name":"date",
"description":"A datetime object in the range of 100AD-9999AD.\n\r NOTE: When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object.",
"required":true,
"default":"",
"type":"date",
"values":[]
}
],
"engines": {
"coldfusion": {"minimum_version":"", "notes":"Member function is available in CF18+.", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/sethour.html"}
},
"examples":[
{"title":"Set Hour to an Date", "description":"", "code":"<cfset myhour = now()>\n<cfoutput>#myhour.setHour(-1)#</cfoutput>"},
{"title":"Set Hour as 1 to an Date", "description":"", "code":"<cfset myhour = '12/23/2024'>\n<cfoutput>#myhour.setHour(1)#</cfoutput>", "result":"{ts '2024-12-23 01:00:00'}"}
],
"links": []
}
34 changes: 34 additions & 0 deletions data/en/setminute.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name":"SetMinute",
"type":"function",
"syntax":"date.SetMinute(number)",
"return":"date",
"related":["setDay","SetMonth","SetYear","SetHour","SetSecond"],
"description":"Sets the minute on the Date object..",
"params":[
{
"name":"number",
"description":"Number representing the minutes.\n\r Number must be an integer.\r\n\nExpected values are 0-59, but other values are allowed:\r\n* -1 results in the last second of the previous minute.\n\r* 60 results in the first second of the next minute.",
"required":true,
"default":"",
"type":"numeric",
"values":[]
},
{
"name":"date",
"description":"A datetime object in the range of 100AD-9999AD.\n\r NOTE: When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object.",
"required":true,
"default":"",
"type":"date",
"values":[]
}
],
"engines": {
"coldfusion": {"minimum_version":"", "notes":"Member function is available in CF18+.", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/set-minute.html"}
},
"examples":[
{"title":"Set Minute to an Date", "description":"Sets the Minute on the Date object.", "code":"<cfset minute = now()>\n<cfoutput>#minute.setMinute(-1)#</cfoutput>"},
{"title":"Set Minute to an Date", "description":"Sets the Minute as 30 on the Date object.", "code":"<cfset minute = '08/15/2023'>\n<cfoutput>#minute.setMinute(30)#</cfoutput>", "result":"{ts '2023-08-15 00:30:00'}"}
],
"links": []
}
34 changes: 34 additions & 0 deletions data/en/setmonth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name":"SetMonth",
"type":"function",
"syntax":"date.SetMonth(number)",
"return":"date",
"related":["setDay","SetMinute","SetYear","SetHour","SetSecond"],
"description":"Sets the month on the Date object..",
"params":[
{
"name":"number",
"description":"Number representing the months.\n\r Number must be an integer.\r\n\n Number range should be 1 to 12.",
"required":true,
"default":"",
"type":"numeric",
"values":[]
},
{
"name":"date",
"description":"A datetime object in the range of 100AD-9999AD.\n\r NOTE: When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object.",
"required":true,
"default":"",
"type":"date",
"values":[]
}
],
"engines": {
"coldfusion": {"minimum_version":"", "notes":"Member function is available in CF18+.", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/setmonth.html"}
},
"examples":[
{"title":"Set Month to an Date", "description":"Sets the Month on the Date object.", "code":"<cfset mymonth = now()>\n<cfoutput>#mymonth.setMonth(10)#</cfoutput>"},
{"title":"Sets the Month as 3 on the Date object", "description":"", "code":"<cfset mymonth = '11/08/2024'>\n<cfoutput>#mymonth.setMonth(3)#</cfoutput>", "result":"{ts '2024-03-08 00:00:00'}"}
],
"links": []
}
34 changes: 34 additions & 0 deletions data/en/setsecond.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name":"SetSecond",
"type":"function",
"syntax":"date.SetSecond(number)",
"return":"date",
"related":["setDay","SetMonth","SetMinute","SetHour","SetYear"],
"description":"Sets the Second on the Date object..",
"params":[
{
"name":"number",
"description":"Number representing the year.\n\r Number must be an integer.\r\n\nExpected values are 0-59, but other values are allowed:\r\n* -1 results in the last second of the previous minute.\n\r* 60 results in the first second of the next minute",
"required":true,
"default":"",
"type":"numeric",
"values":[]
},
{
"name":"date",
"description":"A datetime object in the range of 100AD-9999AD.\n\r NOTE: When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object.",
"required":true,
"default":"",
"type":"date",
"values":[]
}
],
"engines": {
"coldfusion": {"minimum_version":"", "notes":"Member function is available in CF18+.", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/set-second.html"}
},
"examples":[
{"title":"Set Minute to an Date", "description":"Sets the Minute on the Date object.", "code":"<cfset day = now()>\n<cfoutput>#day.Setsecond(56)#</cfoutput>"},
{"title":"Set Year to an Date", "description":"Sets the Year as 2022 on the Date object.", "code":"<cfset day = '11/24/2022'>\n<cfoutput>#day.Setsecond(10)#</cfoutput>", "result":"{ts '2022-11-24 00:00:10'}"}
],
"links": []
}
34 changes: 34 additions & 0 deletions data/en/setyear.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name":"SetYear",
"type":"function",
"syntax":"date.SetYear(number)",
"return":"date",
"related":["setDay","SetMonth","SetMinute","SetHour","SetSecond"],
"description":"Sets the Year on the Date object..",
"params":[
{
"name":"number",
"description":"Number representing the year.\n\r Number must be an integer.",
"required":true,
"default":"",
"type":"numeric",
"values":[]
},
{
"name":"date",
"description":"A datetime object in the range of 100AD-9999AD.\n\r NOTE: When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object.",
"required":true,
"default":"",
"type":"date",
"values":[]
}
],
"engines": {
"coldfusion": {"minimum_version":"", "notes":"Member function is available in CF18+.", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/setyear.html"}
},
"examples":[
{"title":"Set Minute to an Date", "description":"Sets the Minute on the Date object.", "code":"<cfset myyear = now()>\n<cfoutput>#myyear.setYear(2020)#</cfoutput>"},
{"title":"Set Year to an Date", "description":"Sets the Year as 2022 on the Date object.", "code":"<cfset myyear = '11/24/2022'>\n<cfoutput>#myyear.setYear(2022)#</cfoutput>", "result":"{ts '2022-11-24 00:00:00'}"}
],
"links": []
}

0 comments on commit c83d4dc

Please sign in to comment.