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
Super User

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
Super User

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
Super User

@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
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,392)