Hi @Juan Pazo ,
Thank you for reaching out to Microsoft Q&A for this question.
The issue is related to second parameter of [datetime]::parseexact
- i.e., the format string. Note that PowerShell uses the .NET assembliess and conventions. In .NET, date and year are represented by lower-case letters ( dd
and yyyy
respectively). Therefore, the $time
variable should be assigned as:
$time = [datetime]::parseexact($RGTAG_Expiration,'yyyy-MM-dd', $null).ToString('MM/dd/yyyy')
For details on DateTime format string in .NET, please see Custom date and time format strings
I believe that you are rereferring to the following Azure Doc, related to format of DateTime for Azure Storage. This article specifies the guidelines to be used for DateTime format in Azure Storage. The mentioned letters are provided for generic understanding (which is independent of programming/scripting language/framework). That format will have to be accordingly translated, depending on the programming/scripting language being used.
Formatting DateTime values in Azure Storage
Please let me know if you have any questions.
---
Please 'Accept as answer' if it helped so that it can help others in the community looking for help on similar topics.