Hi there
I have a formula and it's getting the date from utc timezone. So right now it's a day behind my local time. The 'HH:mm' is fine because that is being pulled from a field in my dataverse, as you can see in the formula below.
It's also concatenating the date and time and if the variable is empty then it just outputs 'empty' to use later in a condition.
So all I need to do is convert the date ('yyyy/MM/dd') to AUS Eastern Standard Time from utc so its the correct day on output of my variable, as mentioned right now its a day behind so I cant compare the variable with my local time.
Here is what I attempted in writing out the formula -
if(empty(items('Apply_to_each_Employee')?['fff_defaultstarttime']), 'Empty',convertFromUtc(concat(UtcNow('yyyy/MM/dd'), 'AUS Eastern Standard Time', ' ', formatdateTime(items('Apply_to_each_Employee')?['fff_defaultstarttime'], 'HH:mm'))))
Unfortunately I get this error - 'The template language function 'convertFromUtc' expects a timestamp as the first parameter, a target time zone as the second parameter, and an optional format string as the third parameter. The function was invoked with '1' parameter(s)
Thanks everyone in advance.
Solved! Go to Solution.
Here are some examples that may help:
Compose 2:
----------
convertFromUtc(utcNow(), 'AUS Eastern Standard Time', 'yyyy-MM-dd')
2021-11-11
Compose 3 with concat:
----------------------
convertFromUtc(utcNow(), 'AUS Eastern Standard Time', concat('yyyy-MM-dd','T17:52'))
2021-11-11T17:52
Compose 4 (make sure output of Compose 3 is a valid date/time
-------------------------------------------------------------
formatDateTime(outputs('Compose_3'),'hh:mm tt')
05:52 PM
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
The expression needs to be modified like this so that it will convert from UTC to AUS time:
convertFromUtc(utcNow(),'AUS Eastern Standard Time','yyyy-MM-ddThh:mm')
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Ellis
Hi @ekarim2020
Thanks for your message.
So it's not possible to just change the Date from Utc? I need to take my HH:mm value from a field in dataverse thus I'm i am trying to concat converted current date and a time value taken from dataverse. Is it possible to write the formula like this? Also where would the concat fit in here?
Thank you again.
Here are some examples that may help:
Compose 2:
----------
convertFromUtc(utcNow(), 'AUS Eastern Standard Time', 'yyyy-MM-dd')
2021-11-11
Compose 3 with concat:
----------------------
convertFromUtc(utcNow(), 'AUS Eastern Standard Time', concat('yyyy-MM-dd','T17:52'))
2021-11-11T17:52
Compose 4 (make sure output of Compose 3 is a valid date/time
-------------------------------------------------------------
formatDateTime(outputs('Compose_3'),'hh:mm tt')
05:52 PM
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
and also (which I think is what you originally meant):
convertFromUtc(concat(utcNow('yyyy-MM-dd'),'T00:22Z'), 'AUS Eastern Standard Time', 'yyyy/MM/dd hh:mm tt')
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Hi @ekarim2020
Thanks for that it pointed me in the right direction.
I have created this expression-
('compose date' holds the converted date and 'time check Variable' I just need the time)
if(empty(items('Apply_to_each_Employee')?['fff_defaultstarttime']), 'Empty', formatDateTime(concat(outputs(‘Compose Date’), ' ', outputs(‘Time Check Variable'), 'HH:mm')))
But I get a pop up telling me that my expression is invalid. Is there anything that stands out to you?
Nevermind I used -
If this will suit your needs, uou can a null value instead of the text 'Empty',
Ellis
User | Count |
---|---|
88 | |
40 | |
23 | |
20 | |
16 |
User | Count |
---|---|
130 | |
50 | |
48 | |
35 | |
26 |