web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If statement for UK ti...
Power Apps
Unanswered

If statement for UK time zone

(0) ShareShare
ReportReport
Posted on by 225

Hi all

 

I'm working on an app where everything is displayed in local time apart from one thing.  We have a line of code that acts as a cut off.

 

Set(vCutOffEdit, If(Hour(Now()) < 13, DateAdd(Now(), -25, TimeUnit.Hours), Today() + Time(13, 0, 0)));

 

For all other statements, we want the users of the app to use local time but this cut off must be applied to UK time.  I feel like the whole statement from the If needs to be wrapped in some kind of conversion but am drawing a blank how to do this - of course I could be wrong).

 

I've looked for functions etc but cannot work out how to action this as UK time.  Of course, there is the added complication that the UK has British Summertime.  

 

Any help would be appreciated 🙂

  

 

Categories:
I have the same question (0)
  • joyle Profile Picture
    Microsoft Employee on at

    Not sure if I'm following your problem. Have you tried UTC functions?
    Now, Today, IsToday, UTCNow, and UTCToday functions in Power Apps - Power Platform | Microsoft Learn

  • Chocolate_Pizza Profile Picture
    225 on at

    Hi Joyle

     

    Thanks for your reply, I know it will use the UTC functions (and maybe others?) but I just can't work out the syntax.

     

    As explained I want the whole statement to be applied to UK time, not local time, so:

    whatever the time is now in the UK, if it is before 1pm (in the UK), show the results for the last 25 hours (in the UK), otherwise if it is after 1pm (in the UK), show the results from 1pm onwards (in the UK).

     

    I hope this makes it a bit clearer.

  • Chocolate_Pizza Profile Picture
    225 on at

    I've tried doing this, after looking at the microsoft power platform function page and it just errors:

     

    Set(vCutOffEdit, If(Hour( UTCNow()) < 13, DateAdd( UTCNow(), -25, TimeUnit.Hours), UTCToday() + Time(13, 0, 0)));

     

    But I still don't think this would be correct anyway, as I need to specify it is as UK time

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 491

#2
WarrenBelz Profile Picture

WarrenBelz 407 Most Valuable Professional

#3
11manish Profile Picture

11manish 331

Last 30 days Overall leaderboard