date formatting – MS SQL

Questionsdate formatting – MS SQL
Dennis denHollander asked 10 years ago

I'm using the Paid version with MS SQL database.

I need an editable date column. In SQL, dates show 2014-01-01, or y-m-d.

Here's the code for one of my columns:

$col = array();
$col["title"] = "Actual Ship Date";
$col["name"] = "actual_ship_date";
$col["width"] = "80";
$col["formatter"] = "date"; // format as date
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d/m/y');
$col["editable"] = true;
$col["datefmt"] = "Y-m-d";
$cols[] = $col;

However, when I use the dialog (I don't use in-line editing) to edit the row, every date shows (and inserts into the DB) December 31, 1969.

If I comment out "formatoptions" and "datefmt" then it works fine … but then I can't customize the format of the date, which I need to do. Needs to show d/m/y instead of Y-m-d

?????

3 Answers
Abu Ghufran answered 10 years ago

Try removing datefmt.
Also check what date format is stored in database table. According to your code, it should be Y-m-d

Dennis denHollander answered 10 years ago

I have removed datefmt, but the same error still occurs. HOWEVER – I noticed it only occurs when the "day" is > 12. Perhaps a bug in the formatoptions??

Yes I have verified that the MS SQL database (using Management Studio) shows Y-m-d

Abu Ghufran answered 10 years ago

I tested by creating same test data, but unable to generate this issue.
Can you send me screenr.com link of the issue.

You can also email me at gridphp@gmail

Your Answer

3 + 20 =

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?