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 / Remove time from a dat...
Power Apps
Answered

Remove time from a datetime value

(1) ShareShare
ReportReport
Posted on by 73

Hi, I have a date picker, I want to take the date from that and add a time string to to to make a datetime. 1st attempt looked something like this:

Datetimevalue(datePicker1.selectedDate && " 15:00")

 

But with this I get an error as the datepicker date is actually a datetime with the time component being "00:00". I tried datevalue(datepicker1.selectedDate) but no change. I know I can do something like "Text(Left(datePicker1.selectedDate,Len(datePicker1.selectedDate)-5))to remove the "00:00", but I feel like I must be missing the intended way of doing it, as it seems like adding a time to a date from a date picker is something that would happen a lot and there'd be a more elegant way of achieving it. Any thoughts? Thanks

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @EP3 

     

    I get no error using

    DateValue(DatePicker1.SelectedDate)

    When putting this in Text property of a Label I get just the Date.

    Note, I also get just the date when using

    DatePicker1.SelectedDate

     

    The following variations also all work for me:

    DateValue(DateTimeValue(DatePicker1.SelectedDate))

    and

    DateValue(Text(DateTimeValue(DatePicker1.SelectedDate)))

     Even if my Date Picker Format is set to DateTimeFormat.LongDateTime

    All of the above still works for me.

     

    Perhaps you have more information of the issue? I could not reproduce it.

  • EP3 Profile Picture
    73 on at

    Thanks very much for checking that so quickly, I'm not at a computer right now but I'm thinking now that I've probably missed something in the date picker settings... I'll update or accept when I get to check it tomorrow. Thanks again!

  • Verified answer
    timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    @EP3 

    My inclination is to define a new DateTime like so. I prefer to avoid techniques that convert text representations of datetimes due to problems that can arise when running apps on devices with different regional settings.

    With({dte:datePicker1.selectedDate}, 
     DateTime(Year(dte),Month(dte),Day(dte),15,0,0)
    )

     

  • EP3 Profile Picture
    73 on at

    Turns out I'd forgotten that I was actually selecting from a label within a gallery, the date in the label was constructed using DateAdd within a sequence to allow the display of x days after the selected date. Anyway. I selected this answer as it makes a great point about the issues of timezones that I hadn't considered and seems like best practice and it did the job. Thanks!

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard