cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rwittels
Resolver I
Resolver I

Patching to SQL date field

I have a column in SQL for a timestamp created as:

Date TIMESTAMP not NULL

When I try and patch to SQL with any of the following, it doesn't work:

 

Date: Text(Now(),"[$-en-GB]yyyy/mm/dd hh:mm:ss")
Date: DateTimeValue(Text(Now(),"[$-en-GB]yyyy/mm/dd hh:mm:ss"))

 

 

Date: Text(DateTimeValue(Now(),"[$-en-GB]yyyy/mm/dd hh:mm:ss"))
Date: DateTimeValue(Now(),"[$-en-GB]yyyy/mm/dd hh:mm:ss")

 

The App checker shows the following error:

The type of this argument 'Date' does not match the expected type 'Blob'. Found type 'DateTime'.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

Have a look at this articles;

https://powerapps.microsoft.com/en-us/blog/working-with-datetime-values-in-sql/

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

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.

View solution in original post

3 REPLIES 3
eka24
Super User III
Super User III

Have a look at this articles;

https://powerapps.microsoft.com/en-us/blog/working-with-datetime-values-in-sql/

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

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.

View solution in original post

timl
Super User III
Super User III

@rwittels 

The timestamp data type in SQL Server stores values that are server generated.

http://www.sqlines.com/sql-server/datatypes/timestamp_rowversion

This would be the reason why you can't patch a value to this field.

If you want to create a column to store to the created /last modified date/time, you could create a column of data type Datetimeoffset instead.

I have changed the Date column to nvarchar(19) in my database and I am using DateTimeValue(ThisItem.Date, "en-GB") in my App so I can sort by date in my gallery. It works.

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 (983)