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 / DateTime Controller Va...
Power Apps
Unanswered

DateTime Controller Value Is Not Changing When The Toggle Value is True

(0) ShareShare
ReportReport
Posted on by 79

Hi All,

 

I have SharePoint List which has a form that customized using PowerApps.

 

In this form I have:

1. Date and Time controller - Email Draft Needed By (Date and time format - Date & Time)

2. Toggle - Same Day Due - Yes/No

 

Properties

Email Draft Neede By Card Name > Email Draft Needed By_DataCard1

Controller Name > dtpEmailDraftNeededBy

dtpEmailDraftNeededBy > DefaultDate

 

Same Day Due Card Name > Same Day Due_DataCard1

Controller Name > tglSameDayDue

 

I want to add few hours to the DefaultDate property of the Email Draft Needed By when the Same Day Due toggle is 'YES'.

 

I used the below formula

 

If(IsBlank(Parent.Default)&&tglSameDayDue.Value=false,Today()+1,If(IsBlank(Parent.Default)&&tglSameDayDue.Value=true,Text(DateAdd(Now(), 4, Hours),"dd-mm-yyyy hh:mm"),Parent.Default)) 

 

The issue is that this formula didn't add hours to Now().

 

Can someone please let me know what I have done wrong?

 

Thanks.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,242 Most Valuable Professional on at

    Hi @chiranjay ,

    Is Parent.Default a Date ? If so you need

    With(
     {
     wDay: DateAdd(Today(),1,Days),
     wHour: DateAdd(Now(),4,Hours)
     },
     Coalesce(
     Parent.Default,
     (!tglSameDayDue.Value && wDay) || wHour
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    155,242 Most Valuable Professional on at

    Hi @chiranjay ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • ChiranJay Profile Picture
    79 on at

    Apologies for the late reply.

     

    Unfortunately your solution didn't work @WarrenBelz 

     

    Could you please let me know what's wrong with the below function()

     

    If(IsBlank(Parent.Default)&&tglSameDayDue.Value=false,Today()+1,If(IsBlank(Parent.Default)&&tglSameDayDue.Value=true,Text(DateAdd(Now(), 4, Hours),"dd-mm-yyyy hh:mm"),Parent.Default)) 

     

    I have applied this function to the DefaultDate property of the Email Draft Needed By(DateTime Picker) when the Same Day Due toggle is 'YES'.

     

    This Email Draft Needed By DateTime Picker is configured to show the dates only from SharePoint list properties. To solve the hours issue, I'm using this part of the function 

     

    Text(DateAdd(Now(), 4, Hours)

     

     

    I can't figure out what I am missing in here.

     

    Thanks in advance.

  • WarrenBelz Profile Picture
    155,242 Most Valuable Professional on at

    Hi @chiranjay ,

    Firstly, if you are using this as a DefaultDate of a Date Picker, it has to be a date, so Text() will not work. Also Date fields are not necessarily blank so, try this (put in your Date Field name)

    With(
     {
     wDay: DateAdd(Today(),1,Days),
     wHour: DateAdd(Now(),4,Hours)
     },
     If(
     Value(ThisItem.YourDateFieldName) > 0,
     ThisItem.YourDateFieldName,
     tglSameDayDue.Value,
     wHour,
     wDay
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 617

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard