cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Community Support
Community Support

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
Post Prodigy
Post Prodigy

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, 

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

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.

Community Support
Community Support

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (12,365)