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

Community site session details

Session Id :
Power Apps - Power Query
Suggested answer

Convert to utc help please

(1) ShareShare
ReportReport
Posted on by 1,159
Hi,
 
I have a canvas power app that writes to a sql azure back end.
 
The column in the table is called QuoteSent and is of type Datetimeoffset(7)
 
In the power app i have a DatePickerCanvas of format short and date time zone set to local (I am in Sydney Australia). To get the time I am using a Text Input Canvas where I type a 24 hour format time like 13:45
 
In my patch statement I have tried all manner of things but just cant get it right as far as writing the correct utc time to the table. It seems like the utc conversion is happening twice.
 
Code so far is inside a with statement.
 
Would be very grateful to get this going.
 
Thanks in Advance
 
Todd
With(
                                            {
                                                qsLocal: DatePickerCanvas1_5.SelectedDate + TimeValue(TextInputCanvas4_1.Value)
                                            },
                                            With(
                                                {
                                                    qt: Patch(
                                                        tblQuotes,
                                                        Defaults(tblQuotes),
                                                        {
                                                            
                                                            QuoteSentDate: If(IsBlank(qsLocal), Blank(), DateAdd(qsLocal, TimeZoneOffset(qsLocal), TimeUnit.Minutes))
                                                            
                                                        }
                                                    )
                                                },
                                                //copy to here
                                                If(
                                                    IsError(qt) || CountRows(Errors(tblQuotes)) > 0,
                                                    Notify("Quote could not be created.", NotificationType.Error, 4000);
                                                    Reset(DatePickerCanvas1_5);
                                                    Reset(DatePickerCanvas4_1);
                                                    Notify(" Quote Added Successfully", NotificationType.Success, 2000);
                                                    //Navigate(Screen1)
                                                )
                                            )
                                        )
 
Categories:
I have the same question (0)
  • Suggested answer
    mmbr1606 Profile Picture
    14,245 Super User 2025 Season 2 on at
    Convert to utc help please
    hey
     

    If my answer was helpful and solved your issue, please mark it as the verified answer.

    If it helped but didn’t fully solve it, I’d appreciate a like. 😊

     
     
    can you try this modification:
    With(
        {
            qsLocal: DatePickerCanvas1_5.SelectedDate + TimeValue(TextInputCanvas4_1.Value)
        },
        With(
            {
                qt: Patch(
                    tblQuotes,
                    Defaults(tblQuotes),
                    {
                        QuoteSentDate: If(IsBlank(qsLocal), Blank(), qsLocal)  // no manual UTC conversion
                    }
                )
            },
            If(
                IsError(qt) || CountRows(Errors(tblQuotes)) > 0,
                Notify("Quote could not be created.", NotificationType.Error, 4000),
                Notify("Quote added successfully", NotificationType.Success, 2000);
                Reset(DatePickerCanvas1_5);
                Reset(TextInputCanvas4_1)
            )
        )
    )
    
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

Last 30 days Overall leaderboard

Featured topics