Skip to main content

Notifications

Community site session details
Power Apps - Building Power Apps
Answered

date is different between data source and date picker selected

Like (0) ShareShare
ReportReport
Posted on 11 May 2020 03:56:14 by 6

Hello 

 

i am building an app to record information, my date picker default is Today(),  but after saved, the date is minus 1 day compare today() in my data source (excel file). but when i display the record in gallery, the date is my submit date.

 

for example: ID 197 and 198, date is 5/11/2020 12:00 AM in Gallery shown, but the date is 5/10/2020 16:00 in data source.

could someone help me solve this issue?

GalleryGallerydatasourcedatasource

Categories:
  • Ad_saladin23 Profile Picture
    2 on 11 Jul 2024 at 06:43:13
    Re: date is different between data source and date picker selected

    Hello, can you help on if the date picker only for the date (no time included)? Thanks

  • Shreyansh Profile Picture
    6 on 14 May 2020 at 11:26:00
    Re: date is different between data source and date picker selected

    Hi @v-xida-msft ,

     

    Thank you for the change, it finally worked, all the date in my Excel and Displayed date are correct.

    But can you tell me why Parent.Default() caused that error, while Today() didn't.

     

    Thanks Once again.

     

    Best Regards,

    Shreyansh

  • v-xida-msft Profile Picture
    on 14 May 2020 at 09:43:20
    Re: date is different between data source and date picker selected

    Hi @Shreyansh ,

    Please set default value within your DateValue1 (DatePicker control). Set the DefaultDate property of the DateValue1 to following:

    Today()

    then try above formula again, check if the issue is solved.

     

    @Bruce_Fei have you taken a try with the solution I provided above? Is it helpful in your scenario?

     

    Best regards,

  • Shreyansh Profile Picture
    6 on 14 May 2020 at 09:28:04
    Re: date is different between data source and date picker selected

    Hi @v-xida-msft 

     

    I had same problem, i tried your solution, but it gave me error, when implementing code in "Update" in this piece of code - 

     

    DateAdd(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0), -TimeZoneOffset(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)), Minutes)

     

     

    The error i got: expected a valid date value as a parameter to 'timezoneoffset' powerapps, recieved value: null

     

    Any idea on this.

     

    Thanks in Advance,

    Shreyansh Parihar

  • v-xida-msft Profile Picture
    on 12 May 2020 at 01:16:27
    Re: date is different between data source and date picker selected

    Hi @Bruce_Fei ,

    Have you taken a try with the solution I provided above?

     

    Based on the issue that you mentioned, I think above solution I provided could achieve your needs. Please take a try with it, check if the issue is solved.

     

    If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

     

    Best regards,

  • KrishnaV Profile Picture
    5,023 on 11 May 2020 at 16:00:28
    Re: date is different between data source and date picker selected

    Hi @Bruce_Fei,

     

    @v-xida-msft has explained with an example on the same function which I have proposed to you and I was also able to achieve the same.

    Please let us know if you still experience any issue.

     

    Note: If my proposal/advice helps, please mark it as the solution.

     

    Regards,

    Krishna

  • Verified answer
    v-xida-msft Profile Picture
    on 11 May 2020 at 08:48:45
    Re: date is different between data source and date picker selected

    Hi @Bruce_Fei ,

    Based on the issue that you mentioned, I think this issue is related to Time Zone. Based on the issue that you mentioned, I have made a test, and the issue is confirmed on my side.

     

    When saving date time value back to Excel table from canvas app, it would convert the submitted date time value from canvas app into UTC format, then save the UTC format date time value back to Excel Table.

     

    I have made a test on my side, please consider take a try with the following workaround:

    12.JPG

     

    13.JPG

    Within the Edit form, set the Update property of the Date time field data card to following:

    DateAdd(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0), -TimeZoneOffset(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)), Minutes)

    set the Default Property of the Date Time field data card to following:

    DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

     

    If you want to reference the stored Date time value from your Excel table in Gallery, please use the following formula:

    13.JPG

    Set the Text property of the Label to following:

    DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

     

    Within your Detail Form, set the Default property of the Date time field data card to following:

    DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • Bruce_Fei Profile Picture
    6 on 11 May 2020 at 07:00:33
    Re: date is different between data source and date picker selected

    Hi, @KrishnaV 

    i try code "Date:DateAdd(InputDate.SelectedDate,TimeZoneOffset(),Minutes)", now the date shown are same day between gallery list and data source, but different time.

    but the day of date is still not my timezone. my time is 5/11/2020 3:00 PM.  how to adjust this code?

    Gallery1.jpgdatasource1.jpg

  • KrishnaV Profile Picture
    5,023 on 11 May 2020 at 06:08:05
    Re: date is different between data source and date picker selected

    Ok this I can see the locatime and date issue. Is your PowerApps environement is local to you? if not this is expected. Try this DateAdd(InputDate.Selected,TimeZoneOffset(),Minutes) this will convert the date & time with respect to your calendar.

     

    Follow the below article from MS:
    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

     

    Note: If this helps mark it as the solution.

     

    Regards,

    Krishna

  • Bruce_Fei Profile Picture
    6 on 11 May 2020 at 05:54:34
    Re: date is different between data source and date picker selected

     

    Hi, @KrishnaV 

    I using excel file for my data source and stored in one drive. first screen is new record screen, second is my save code, i am using collect function. and date time zone is Local for date picker.

    New Record.JPGCode.JPG

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard
Loading started