Looking how to use the datefunction for start and end of year #7187
-
|
Hi, I was wondering if anyone could help with start and end of year please? I was thinking a variable: var startofyear = 'Start = DATE(YEAR(TODAY()),1,1)' anyone had any luck with this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
@GBCSIM1 I don't think that is possible natively in Bicep. It is possible in another way, maybe this helps you: param parStartOfYear string
param parEndOfYear stringYou can override these parameters using (in case of PowerShell) the Get-Date function: az deployment group create --resource-group my-rg --name deployment-name --template-file my-bicep-template.bicep --parameters parStartOfYear="$((Get-Date).Year)/1/1" parEndOfYear="$((Get-Date).Year)/12/31" |
Beta Was this translation helpful? Give feedback.
-
|
You can do as follows param month string = utcNow('MM')
param year string = utcNow('yyyy')
// Use same PAT token for 3 month blocks, min PAT age is 6 months, max is 9 months
var SASEnd = dateTimeAdd('${year}-${padLeft((int(month) - (int(month) -1) % 3),2,'0')}-01', 'P9M') |
Beta Was this translation helpful? Give feedback.
-
|
Ooh no i didn't get a notification. Thank you. I will try this today. Thank you so much |
Beta Was this translation helpful? Give feedback.
You can do as follows