cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ZsoltDunai
Frequent Visitor

"The arugments of DateTimeValue function do not represent a valid Date or Time value" error is received if the current time reaches a whole number (hour)

Hi,

 

I created a label which shows the current hour and minutes based on a timer: If(Mod(Timer2.Value,1000)=0,Hour(Now()),Hour(Now())) & ":" & If(Mod(Timer2.Value,1000)=0,Minute(Now()),Minute(Now())) This work well!

 

However I want my button to be visible if the current time is "reached"/above than a specific time:

 

DateTimeValue(If(Mod(Timer2.Value,1000)=0,Hour(Now()),Hour(Now())) & ":" & If(Mod(Timer2.Value,1000)=0,Minute(Now()),Minute(Now())))>DateTimeValue("8:00")

 

If I put this above DateTimeValue formula to a text label then it works, it says true or false, yaay however when the application runs and reaches a whole time e.g.: 08:59->09:00 the above mentioned formula will give back: The arugments of DateTimeValue function do not represent a valid Date or Time value, If I cut and paste in the EXACT same code again to the exact same place of the application the error is gone and is working fine. 

 

However I would like this to work all the time, not just for 1 hour then always copy paste and publish, anyone any help?

1 ACCEPTED SOLUTION

Accepted Solutions
ZsoltDunai
Frequent Visitor

If anyone interested in the solution:

 

The problem was: after a new hour is started the time was Hour:single digit minute e.g.: 10:4 which caused the error, with the below formula I adjusted that an addition 0 is added if the current minute is below 10 so it would make it to 10:04 which is a valid time.

 

DateTimeValueIf(Mod(Timer2.Value,1000)=0,Hour(Now()),Hour(Now())) & ":" & If(If(Mod(Timer2.Value,1000)=0,Minute(Now()),Minute(Now()))<10,"0" & If(Mod(Timer2.Value,1000)=0,Minute(Now()),Minute(Now())),Minute(Now())))

View solution in original post

2 REPLIES 2
ZsoltDunai
Frequent Visitor

If anyone interested in the solution:

 

The problem was: after a new hour is started the time was Hour:single digit minute e.g.: 10:4 which caused the error, with the below formula I adjusted that an addition 0 is added if the current minute is below 10 so it would make it to 10:04 which is a valid time.

 

DateTimeValueIf(Mod(Timer2.Value,1000)=0,Hour(Now()),Hour(Now())) & ":" & If(If(Mod(Timer2.Value,1000)=0,Minute(Now()),Minute(Now()))<10,"0" & If(Mod(Timer2.Value,1000)=0,Minute(Now()),Minute(Now())),Minute(Now())))

Hi,

 

Thank you for your follow up post! I am glad you were able to get this working. Hopefully this will prove useful to future communities users.

 

Regards,

 

Alex

 

-------

 

Community Support Team _ Alex Rezac
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,943)