cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ncr703
Frequent Visitor

Powerapps datetime to Sharepoint: Always storing the time as 00:00

When I patch now() to sharepoint it stores the date correctly but the time is always midnight (00:00).

 

 

 

 

Patch(SharepointList, LookUp(SharepointList, CustomerID = varCustomer.ID),{
    Raised_DateTime: Now()
})

 

 

 

Which works but shows up in Sharepoint as "30/01/2021 00:00", when it should show "30/01/2021 15:42".

 

I have tried workarounds for this such as converting the date to text and then patching a DateTimeValue() of it...

e.g.

 

 

 

Patch(SharepointList, LookUp(SharepointList, CustomerID = varCustomer.ID),{
    Raised_DateTime: DateTimeValue(Text(Now()))
})

 

 

 

This also does the same thing.

When I set up a label in powerapps to show me the value of Now() it gives me the full datetime.

 

I have googled this to exhaustion.

Does anyone know how to get sharepoint to also store the time correctly?

 

FYI I am in the UK. I have checked the sharepoint site Regional Settings. They are set to:

Time zone = (UTC) London

Region = English (United Kingdom)

Time Format = 24hour

EDIT: Forgot to mention that the column in question is set to Type = Date and Time and the 'Include Time' switch is set to Yes.

1 ACCEPTED SOLUTION

Accepted Solutions

@ncr703 I echo the thoughts of @Pstork1  here in that it 'should' be working as you expect.

 

Have you tried creating a new column with the correct settings and patching to that new one? Also, was this column originally a 'Date only' column which has been changed? This can sometimes cause issues in SharePoint.

View solution in original post

8 REPLIES 8
Pstork1
Dual Super User III
Dual Super User III

The first thing to check is to make sure the SharePoint column settings aren't set for Date Only.  The column will always store a full date and time, but if the column is set to Date only the time will always be midnight UTC.  Otherwise I just tested the following on one of my columns set for Date & Time and it stores both date and time.

Patch(Test_1,LookUp(Test_1,ID=1),{StartTime:Now()})

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
ncr703
Frequent Visitor

Hi Pstork, thanks for responding. I do have a feeling this is something in sharepoint.

I have checked the settings - please see picture below. Do you know if there any other settings other than those referenced in my original post?

Many thanks.

datetime.PNG

Pstork1
Dual Super User III
Dual Super User III

I'm not aware of any other settings.  But I am curious what kind of list this is? AS you can see from the screenshot below I get a different view when editing the column than you do.  I don't recognize the dialog that you are looking at.

image.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
ncr703
Frequent Visitor

The menu I screenshotted comes from clicking the column title and selecting Column Settings -> Edit.

I can reach the same screen as your screenshot by going through Settings (top right corner) -> List Settings and then selecting my Raised_DateTime from 'Columns'.

 

I suspect I'm using the 'new' sharepoint GUI rather than the 'classic' one. I am a new sharepoint user with no experience.

 

Anyway - I have checked my settings. They are identical to yours. I have also copied your code and it still shows the time as 00:00.

Copied code (in OnSelect on a new button):

Patch(TMS_Test_Request_Main, LookUp(TMS_Test_Request_Main, ID=1),{Raised_DateTime:Now()})



Pstork1
Dual Super User III
Dual Super User III

Got it. I didn't remember the ability to edit the individual columns from the list.  I've been at it a long time and just have always gotten used to going through the list settings to edit the columns. But mine is also a "Modern" list.  So no differences there.  I don't have anything else to suggest other than checking to validation or column formatting settings to see if some javascript is being applied during the save.  As I said it works for me on a regular DateTime column in a modern list.  From what I see it should work in yours too.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@ncr703 I echo the thoughts of @Pstork1  here in that it 'should' be working as you expect.

 

Have you tried creating a new column with the correct settings and patching to that new one? Also, was this column originally a 'Date only' column which has been changed? This can sometimes cause issues in SharePoint.

View solution in original post

Pstork1
Dual Super User III
Dual Super User III

One other thought.  If it was changed from Date Only to Date and Time, but the data source wasn't refreshed that could be an issue also.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
ncr703
Frequent Visitor


@Eelman wrote:

@ncr703 I echo the thoughts of @Pstork1  here in that it 'should' be working as you expect.

 

Have you tried creating a new column with the correct settings and patching to that new one? Also, was this column originally a 'Date only' column which has been changed? This can sometimes cause issues in SharePoint.


That was it! I deleted the column and re-made it, and its now working fine.

You are correct - When I created that column several days ago I failed to tick the 'Include Time' column. Apparently switching it on later can cause this issue.

Thanks to both of your Eelman and Pstork for getting to the bottom of this.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (91,402)