You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -3,31 +3,31 @@ title: Template functions - date
3
3
description: Describes the functions to use in an Azure Resource Manager template (ARM template) to work with dates.
4
4
ms.topic: reference
5
5
ms.custom: devx-track-arm-template
6
-
ms.date: 02/12/2025
6
+
ms.date: 08/08/2025
7
7
---
8
8
9
9
# Date functions for ARM templates
10
10
11
11
This article describes the functions for working with dates in your Azure Resource Manager template (ARM template).
12
12
13
13
> [!TIP]
14
-
> We recommend [Bicep](../bicep/overview.md) because it offers the same capabilities as ARM templates and the syntax is easier to use. To learn more, see [date](../bicep/bicep-functions-date.md) functions.
14
+
> [Bicep](../bicep/overview.md)is recommended because it offers the same capabilities as ARM templates, and the syntax is easier to use. To learn more, see [`date`](../bicep/bicep-functions-date.md) functions.
15
15
16
16
## dateTimeAdd
17
17
18
18
`dateTimeAdd(base, duration, [format])`
19
19
20
20
Adds a time duration to a base value. ISO 8601 format is expected.
21
21
22
-
In Bicep, use the [dateTimeAdd](../bicep/bicep-functions-date.md#datetimeadd) function.
22
+
In Bicep, use the [`dateTimeAdd`](../bicep/bicep-functions-date.md#datetimeadd) function.
23
23
24
24
### Parameters
25
25
26
26
| Parameter | Required | Type | Description |
27
27
|:--- |:--- |:--- |:--- |
28
28
| base | Yes | string | The starting datetime value for the addition. Use [ISO 8601 timestamp format](https://en.wikipedia.org/wiki/ISO_8601). |
29
29
| duration | Yes | string | The time value to add to the base. It can be a negative value. Use [ISO 8601 duration format](https://en.wikipedia.org/wiki/ISO_8601#Durations). |
30
-
| format | No | string | The output format for the date time result. If not provided, the format of the base value is used. Use either [standardformat strings](/dotnet/standard/base-types/standard-date-and-time-format-strings) or [customformat strings](/dotnet/standard/base-types/custom-date-and-time-format-strings). |
30
+
| format | No | string | The output format for the datetime result. If not provided, the format of the base value is used. Use either [standard-format](/dotnet/standard/base-types/standard-date-and-time-format-strings) or [custom-format](/dotnet/standard/base-types/custom-date-and-time-format-strings) strings. |
31
31
32
32
### Return value
33
33
@@ -67,9 +67,40 @@ In the preceding example, considering 2023 as a non-leap year, the outcome of ad
67
67
68
68
### Examples
69
69
70
-
The following example template shows different ways of adding time values.
70
+
The following example template shows different ways of adding time values:
Returns the current (UTC) datetime value in the specified format. If no format is provided, the ISO 8601 (`yyyyMMddTHHmmssZ`) format is used. **This function can only be used in the default value for a parameter.**
207
286
208
-
In Bicep, use the [utcNow](../bicep/bicep-functions-date.md#utcnow) function.
287
+
In Bicep, use the [`utcNow`](../bicep/bicep-functions-date.md#utcnow) function.
209
288
210
289
### Parameters
211
290
212
291
| Parameter | Required | Type | Description |
213
292
|:--- |:--- |:--- |:--- |
214
-
| format |No |string |The URI encoded value to convert to a string. Use either [standardformat strings](/dotnet/standard/base-types/standard-date-and-time-format-strings) or [customformat strings](/dotnet/standard/base-types/custom-date-and-time-format-strings). |
293
+
| format |No |string |The URI encoded value to convert to a string. Use either [standard-format](/dotnet/standard/base-types/standard-date-and-time-format-strings) or [custom-format strings](/dotnet/standard/base-types/custom-date-and-time-format-strings). |
215
294
216
295
### Remarks
217
296
218
297
You can only use this function within an expression for the default value of a parameter. Using this function anywhere else in a template returns an error. The function isn't allowed in other parts of the template because it returns a different value each time it's called. Deploying the same template with the same parameters wouldn't reliably produce the same results.
219
298
220
-
If you use the [option to rollback on error](rollback-on-error.md) to an earlier successful deployment, and the earlier deployment includes a parameter that uses `utcNow`, the parameter isn't reevaluated. Instead, the parameter value from the earlier deployment is automatically reused in the rollback deployment.
299
+
If you use the [option to rollback on error](rollback-on-error.md) to an earlier successful deployment when the earlier deployment includes a parameter that uses `utcNow`, the parameter isn't reevaluated. Instead, the parameter value from the earlier deployment is automatically reused in the rollback deployment.
221
300
222
301
Be careful redeploying a template that relies on the `utcNow` function for a default value. When you redeploy and don't provide a value for the parameter, the function is reevaluated. If you want to update an existing resource rather than create a new one, pass in the parameter value from the earlier deployment.
223
302
224
303
### Return value
225
304
226
-
The current UTC datetime value.
305
+
The current UTC **datetime** value.
227
306
228
307
### Examples
229
308
230
-
The following example template shows different formats for the datetime value.
309
+
The following example template shows different formats for the datetime value:
0 commit comments