Search on Datetime column (postgresql timestamptz)

QuestionsSearch on Datetime column (postgresql timestamptz)
Jin Lee asked 2 years ago

Hi,

I have a datetime column that is displayed well but search on that column causes an error. The column is from Postgresql timestamptz data type. (i.e. 2023-01-18 10:13:01.272 +1000)

In my grid, I need to display the time in this format, d/m/Y H:i:s so I added the following code.

$col[“formatter”] = “datetime”;
$col[“formatoptions”] = array(“srcformat”=>’d/m/Y H:i:s’,”newformat”=>’d/m/Y H:i:s’);

The grid shows correct format like 18/01/2023 00:14:19 in UTC.

The problem is when I search on this column (here I used “less 19/1/2023 00:00:00” as a filter), there is an error. (apache error log)

PHP Fatal error: Uncaught TypeError: date_format(): Argument #1 ($object) must be of type DateTimeInterface, bool given in C:\\Apache24\\htdocs\\iceGIS3\\lib\\inc\\jqgrid_dist.php:8631\nStack trace:\n#0 C:\\Apache24\\htdocs\\iceGIS3\\lib\\inc\\jqgrid_dist.php(8631): date_format(false, ‘d/m/Y H:i:s’)\n#1 C:\\Apache24\\htdocs\\iceGIS3\\lib\\inc\\jqgrid_dist.php(474): jqgrid->custom_date_format(‘d/m/Y H:i:s’, ’19/01/2023 00:0…’, ‘d/m/Y H:i:s’)\n#2 C:\\Apache24\\htdocs\\iceGIS3\\lib\\inc\\jqgrid_dist.php(373): jqgrid->make_where(Array)\n#3 C:\\Apache24\\htdocs\\iceGIS3\\lib\\inc\\jqgrid_dist.php(3073): jqgrid->construct_where(‘{“groupOp”:”AND…’)\n#4

 

Could you please let me know what I’m doing wrong?

Thank you!!

2 Answers
Abu answered 2 years ago

Hello, I’m emailing you a new build that solves this issue.

Jin answered 2 years ago

Thank you very much for the new build. It’s working now.

Your Answer

6 + 18 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?