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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to store in ShareP...
Power Apps
Answered

How to store in SharePoint two dates/time as all Dates

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have two DatePicker (Start and End) in my app, for instance I selected from Feb 15 to Feb 16, see below:

   FromTuesday, February 15, 2022

   To: Wednesday, February 16, 2022

 

As part of the app, a collection of dates DateRange is created with the From and To dates for different purpose.

 

I noticed that the dates in the collection have the current time, as below:

   First(DateRange).Date shows as:

      Start 2/15/2022 11:18 AM

   Last(DateRange).Date shows as 

      End 2/16/2022 11:18 AM

 

*time when I run the app

 

When it is Patch-ed to SharePoint, I use as:

{

   From: First(DateRange).Date,
   To: Last(DateRange).Date,

}

 

Therefore date/time fields are stored in SharePoint with 11:18 AM time (time when app was run). My request is to store the dates as below example:

Start 2/15/2022 12:00 AM

End 2/16/2022 11:59 PM

 

What instruction(s) should I add to store the dates in SharePoint as it?

 

Thank you

Categories:
  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    Hi @Willy-C ,

    Can you please supply your Patch code (in Text). There is no reason these two date picker values cannot be stored as dates (their time will be 0:00 if you do not supply one). The Created value however will reflect when you created the record (data and time).

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Warren
    Here is the patch code:


    Patch(
       'Time Off Requests',
       {
          Title: curUserEmail,
          From: First(DateRange).Date,
          To: Last(DateRange).Date,
          TimeOffType: {
                Id: selectedType.ID,
                Value: selectedType.Title,
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
          },
       }
    );

     

    The SharePoint fields are updated with the full value (date and time) from DateRange.Date collection.

    Keep in mind I would like to reset the time of the two fields before patching to reflect as follows:

          Start as 2/15/2022 12:00 AM

          End as 2/16/2022 11:59 PM

     

    Thanks

  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    Hi @Willy-C ,

    Now the question is how do you collect DateRange and when?

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I was able to override the time for Start and To SharePoint Column while patching by tweaking the two dates as below:

     

    Start: DateTimeValue(Text(First(DateRange).Date,DateTimeFormat.ShortDate) & " " & Time(0,0,0),"en-US"),
    To: DateTimeValue(Text(Last(DateRange).Date,DateTimeFormat.ShortDate) & " " & Time(23,59,0),"en-US")

     

    Thanks

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard