Hi @Tony Johansson ,
Welcome to Microsoft Q&A forum and thanks for reaching out here.
If you would like to have your timestamp in 24 hr format, then specify the format as HH
and if you would like to have the timestamp as 12 hr format then use hh
. In addition as @Vinodh247 , called out you can use tt
to represent AM/PM. Below are some samples.
24 hour format specifier:
@formatDateTime(convertFromUtc(utcnow(), 'Pacific Standard Time'), 'yyyy/MM/dd HH:mm:ss tt')
The output for the above expression will be : 2023/04/25 15:37:48 PM
12 hour format specifier:
@formatDateTime(convertFromUtc(utcnow(), 'Pacific Standard Time'), 'yyyy/MM/dd hh:mm:ss tt')
The output for above expression will be: 2023/04/25 03:37:48 PM
Here is a sample pipeline payload which I used for testing. Feel free to use it for your testing.
{
"name": "pipeline13",
"properties": {
"activities": [
{
"name": "Set variable1",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "varTime",
"value": {
"value": "@formatDateTime(convertFromUtc(utcnow(), 'Pacific Standard Time'), 'yyyy/MM/dd HH:mm:ss tt')",
"type": "Expression"
}
}
}
],
"variables": {
"varTime": {
"type": "String"
}
},
"annotations": []
}
}
Hope this helps.