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

Patch date and time, time not showing

Hi

 

I'm trying to patch date and time to SharePoint List. But the time value is shown as 00:00

let me know what is wrong with the below code

 

Patch(ExternalAccess,LookUp(ExternalAccess,ID=galID),
{FormStatus:"Access Revoked",
 RevokedBy:LogInUserName,
 RevokedDate:DateValue(
            Text(
                Today(),
                "[$-en-US]dd-mm-yyyy hh:mm AM/PM"
            ),
           "en-GB"
            ),
            
RevokerComment:RevokeComment_2.Text    
});
         
If(IsEmpty(Errors(ExternalAccess)),Notify("Record Has Been Updated Successfully");Navigate(AccessGallery,ScreenTransition.Cover),
Notify("The Process Could Not Be Completed, Record not Added"))

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@indhaa 

Change your RevokedDate part of the formula to the following:  RevokedDate : Now()

Also, ensure that your column definition for RevokedDate also includes times and not just date.

 

Your use of the DateValue and the Today() functions will only return dates, not times.

 

However, at the same time, there is no need to convert a datetime value to a string and then convert it back to a datetime value - which is what you are doing in that formula.  

 

So, just change to the above formula and you should get both date and time in your datasource.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
rubin_boer
Super User
Super User

hi @indhaa try DateTimeValue 

Abhilash_Swain
Resolver II
Resolver II

change DateValue to DateTimeValue

RandyHayes
Super User III
Super User III

@indhaa 

Change your RevokedDate part of the formula to the following:  RevokedDate : Now()

Also, ensure that your column definition for RevokedDate also includes times and not just date.

 

Your use of the DateValue and the Today() functions will only return dates, not times.

 

However, at the same time, there is no need to convert a datetime value to a string and then convert it back to a datetime value - which is what you are doing in that formula.  

 

So, just change to the above formula and you should get both date and time in your datasource.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,148)