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 / get date and time from...
Power Apps
Unanswered

get date and time from date-time picker and put it in a variable

(0) ShareShare
ReportReport
Posted on by 4

i have a power app based on an sql server an im building a form for calculating working hours. 

 

This is the update statement date and time picker: DateAdd(SetTimeStart;-TimeZoneOffset(SetTimeStart);Minutes)

 

Default date-time = Now()

 

User can select an other date and time if so:

 

Set(SetTimeStart;Date.SelectedDate + Time(Value(Hour.Selected.Value);Value(Minute.Selected.Value);0))

 

Problem: The date and time in the variable is not the selected date and time. 

 

 

 

 

datetimevar.PNG
Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Frans1959,

     

    Could you please share a bit more about your scenario?

    Further, could you please share more details about the update statement of Date and time picker that you mentioned?

     

    I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:1.JPG

     

    2.JPG

    Note: The DateTimeZone property of the Date picker control within my Edit form set to following:

    DateTimeZone.Local

     

     

    I think this issue is related to the time zone. The update statement of date and time pciker that you mentioned (as below):

    DateAdd(SetTimeStart;-TimeZoneOffset(SetTimeStart);Minutes)

    The above formula is used to convert a UTC time into your local time. If you want to use the above formula to convert time, you must make sure that the SetTimeStart variable stores a UTC time. I suppose that you have set the DateTimeZone property of the Date picker control to DateTimeZone.UTC, is it true?

     

    More details about converting from UTC time within PowerApps, please check the following article:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff#converting-from-utc

     

    Please check if the DateTimeZone property of the Date picker control within your Edit form is set to following:

    DateTimeZone.UTC

    Please take a try to set the DateTimeZone property of the Date picker control within your Edit form to following:

    DateTimeZone.Local

    and then try your variable (SetTimeStart) again, check if the issue is solved.

     

    Best regards,

    Kris

  • Frans1959 Profile Picture
    4 on at

    Hello Kris, Thank you for helping me out!

     

    Note: datetimepicker is set to local

     

    Step1 set var and open the form ( i use 2 vars so they don't mixed up)

     

    step2 onselect the green clock butten is set the var SetTimeStart

     

    the text label var = SetTimeStart is set to var SetTimeStart

     

    at this point so var the label gives me already the wrong date and time so going next step has no use.

     

     

     

     

     

     

     

     

     

     

     

    step2.PNG
    step3.PNG
    step1.PNG
  • Frans1959 Profile Picture
    4 on at

    note: i have set the dateTimePicker to local and also at utc but can get the right time in label.

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 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard