cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

How to update current date and time with "date and time" list column in SharePoint?

Hello,

 

I have a Date and Time field in SharePoint list that displays date and time both.

 

I want to patch, current date and time in that field, and I have tried followings in Patch function:

 

Today()+Text(Now(), "[$-en-US]hh")+Text(Now(), "[$-en-US]mm")

 

However, this is not working out, Would you please share how can I patch current date and time with "date and time" list column in SharePoint?

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to update current date and time with "date and time" list column in SharePoint?

Hi @dave8 ,

Could you please share a bit more about your your Patch formula used within your canvas app?

 

If you want to create a new record in your SP List, please try the following formula:

Patch(
      'Your SP List',
      Defaults('Your SP List'),
      {
        Title: "xxx",
        DateTimeField: Now()
      }
)

If you want to update existing record in your SP List, please try the following formula:

Patch(
      'Your SP List',
      LookUp('Your SP List', PrimaryColumn = "Specific value"), // find the record you want to update
      {
        DateTimeField: Now()
      }
)

Note: Please assign Now() function result to the DateTimeField directly within your Patch function.

 

In addition, you could also consider use the following formula to get the current date time value for the DateTimeField in your SP List:

Today() + Time(Hour(Now()), Minute(Now()),Second(Now()))

 

When saving date time value from your canvas app back to your SP List, you may face time zone issue -- the date time value within your canvas app is not same as that saved in your SP List. Please make sure the Time Zone settings of your SP Site is set to your local time zone.

6.JPG

 

 Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Post Prodigy
Post Prodigy

Re: How to update current date and time with "date and time" list column in SharePoint?

Looks like this should be working - 

DateAdd(Now(),0,Minutes)

However, my Patch function is not working, therefore I could not realize the root cause.

 

Thanks, 

Highlighted
Super User
Super User

Re: How to update current date and time with "date and time" list column in SharePoint?

There is also a Today function within PowerApps, FYI.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-now-today-istoday

 

There is also an Errors function, to allow you to dig deeper into why you Patch is failing.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-errors

Highlighted
Super User
Super User

Re: How to update current date and time with "date and time" list column in SharePoint?

Kindly show the Patch formula you are using

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Highlighted
Community Support
Community Support

Re: How to update current date and time with "date and time" list column in SharePoint?

Hi @dave8 ,

Could you please share a bit more about your your Patch formula used within your canvas app?

 

If you want to create a new record in your SP List, please try the following formula:

Patch(
      'Your SP List',
      Defaults('Your SP List'),
      {
        Title: "xxx",
        DateTimeField: Now()
      }
)

If you want to update existing record in your SP List, please try the following formula:

Patch(
      'Your SP List',
      LookUp('Your SP List', PrimaryColumn = "Specific value"), // find the record you want to update
      {
        DateTimeField: Now()
      }
)

Note: Please assign Now() function result to the DateTimeField directly within your Patch function.

 

In addition, you could also consider use the following formula to get the current date time value for the DateTimeField in your SP List:

Today() + Time(Hour(Now()), Minute(Now()),Second(Now()))

 

When saving date time value from your canvas app back to your SP List, you may face time zone issue -- the date time value within your canvas app is not same as that saved in your SP List. Please make sure the Time Zone settings of your SP Site is set to your local time zone.

6.JPG

 

 Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,654)