Skip to main content

Notifications

Power Apps - Error Handling
Answered

Date problem

(0) ShareShare
ReportReport
Posted on by 6
Hello, I am facing an issue with a gallery that displays a column containing dates. When I open the file in Excel, the date appears correctly. However, when the data is shown in the gallery, it seems to display one day earlier. Does anyone know why this might be happening? Any help or insights would be greatly appreciated.
 
       
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,343 on at
    Date problem
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • WarrenBelz Profile Picture
    WarrenBelz 145,343 on at
    Date problem
    Yes - same issue. Excel is problematic with dates as they can only be stored in Text (as in your case) or effectively a number. If you bring it all into SharePoint, all of this will go away as the Date field also allows for the Time Zone of the server and local device.
    You are going to need to add the TimeZoneOffset to every query reference of the data in your Table.
    Also (depending on where you are based), TimeZoneOffset is a negative value, so you should need to reverse it to add to the field value.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

  • BP-06122300-0 Profile Picture
    BP-06122300-0 6 on at
    Date problem
    I tried it with positive TimeZoneOffset() and it works. Thanks!
     
    I have an issue with a button in my code. When it writes to the table, it adds the data to the next day instead of the current day. I believe the problem is related, but I'm not sure how to fix it
     
    Set(selectedYear; DropdownYear.Selected.Value);;
    Set(selectedMonth; DropdownMonth.Selected.Value);;
    Set(selectedDay; DropdownDay.Selected.Value);;
    Set(hoursValue; Input_Hours.Text);;
    Set(Activities; Input_Activity.Text);;
    
    Set(formattedDate;DateTimeValue(selectedDay & "/" & selectedMonth & "/" & selectedYear));;
    
    
    If(
        IsBlank(selectedYear) || IsBlank(selectedMonth) || IsBlank(selectedDay) || IsBlank(Activities) ||IsBlank(hoursValue);
        Notify("Please fill in all required fields before proceeding.";NotificationType.Error;5000);
        Switch(
            Input_User.Text;
            "bperez";
            If(
                IsBlank(
                    LookUp(
                        bperez;
                        DateValue(Text(Date)) = DateValue(Text(formattedDate));
                        Proposal
                    )
                );
                UpdateIf(
                    brunoperez;
                    DateValue(Text(Date)) = DateValue(Text(formattedDate));
                    {
                        Activity: Activities;
                        Hours: Value(hoursValue)
                    }
                )
            );
            "crivera";
            If(
                IsBlank(
                    LookUp(
                        crivera;
                        DateValue(Text(Date)) = DateValue(Text(formattedDate));
                        Proposal
                    )
                );
                UpdateIf(
                    conirivera;
                    DateValue(Text(Date)) = DateValue(Text(formattedDate));
                    {
                        Activity: Activities;
                        Hours: Value(hoursValue)
                    }
                )
            )
        )
    );;
    
     
  • BP-06122300-0 Profile Picture
    BP-06122300-0 6 on at
    Date problem
    It doesn't work, it keeps showing a day early 
    When I try with a label it show me this

    It's like it's reading 3 hours early
  • WarrenBelz Profile Picture
    WarrenBelz 145,343 on at
    Date problem
    Hi @BP-06122300-0​​​​​​​
    Apart from Excel and Dates in Power Apps not being "good friends", I suspect this is a Time Zone issue, so firstly try
    DateAdd(
       ThisItem.YourDateField, 
       -TimeZoneOffset(), 
       Minutes
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard

Featured topics