MS SQL Date Write ISO 8601 Display ISO 120

QuestionsMS SQL Date Write ISO 8601 Display ISO 120
Kel asked 9 years ago

I am using the paid version of PHPGrid.

My backend is an MS SQL 2014 DB.

I have an editable date time field stored in an ISO 8601 format.

The field needs to displayed and edited as ISO 120
yyyy-mm-dd hh:mm:ss

$col = array();
$col["title"] = "Checked Date";
$col["name"] = "CheckByDate";
$col["width"] = "10";
$col["formatter"] = "datetime";
$col["dbname"] = "CONVERT(CHAR(23),CheckByDate, 120)";
$col["editable"] = true;
$cols[] = $col;

The datepicker is selecting the corrrect datetime, but when the field is stored incorrectly.

I have tried various $col["formatoptions"] options, but none of them have done the trick.

4 Answers
Abu Ghufran answered 9 years ago

To store datetime field in format: 2000-07-01T00:00:00+00:00

Edit jqgrid_dist.php

$data[$c["index"]] = date("Y-m-d H:i:s",strtotime($data[$c["index"]]));

$data[$c["index"]] = date(DATE_ATOM,strtotime($data[$c["index"]]));

I've not tested it but it's from php doc.

Abu Ghufran answered 9 years ago

I'm unable to understand completely. Please email screenshots, it would help.
If you can share screen on skype, id: gridphp

Kel answered 9 years ago

Made change to jqgrid_dist.php.

Still having same issue.

DatePicker is selecting correct date time
Datetime is being stored correctly in database field in table.

PHPGrid column is displaying datetime incorrectly.

In fact, when editing field with incorrect datetime, the datepicker is picking up the incorrect field to edit.


Kel answered 9 years ago

Thanks for the updated code.

So far it seems to be working.

Your Answer

15 + 14 =

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?