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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / DateAdd to date and empty
Power Apps
Answered

DateAdd to date and empty

(0) ShareShare
ReportReport
Posted on by 137

Hi

I want to add some hours and minutes to a variable, but after change datetimeformat, the varialbe goes to empty.

I tryed:

 

Set(
 Hora930;
 DateAdd(
 DateAdd(
 DateValue(
 // DateValue5.SelectedDate;
 Today();
 DateTimeFormat.ShortDate
 );
 9;
 TimeUnit.Hours
 );
 30;
 TimeUnit.Minutes
 )
);;

 

 But when i try to view Hora930 to a textbox its empty ,also when i try to view the variable in Powerapp variables.

But if i comment DateTImeFormat.ShortDate with // i see in the textbox: 10 marzo 2023

 

Does anybody know whats happend?

Thanks

 

 

Categories:
I have the same question (0)
  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    Hello @llserra ,
    First you can use now() instead of today() to get the time
    Today only refers to the date of today without the time while now refers to the date and time of now
    And when you want to convert to a date&time value you have to use DateTimeValue instead of DateValue.

    DateAdd( [DateAndTime], [Time you want to add], [Unit])

    for example:
    DateAdd( Now(), 2, TimeUnit.Hours)

    Now= 3/10/2023 2:28 PM ( My Time)

    The function will return =>  3/10/2023 4:28 PM

    Please refer my comment as accepted solution if it fix your problem,
    Regards, 
    Oussama.

  • llserra Profile Picture
    137 on at

    HI ,thanks it works!!! ,thanks a lot for your help

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard