01-01-1970

Questions01-01-1970
Samsun asked 5 years ago

Hello,

I have problem when my table have field with date type. When the data is null will display 01-01-1970. Would you like to give me a suggest to solve the problem?

FYI, the database is Oracle.

Regards,
SAmsun

3 Answers
Abu Ghufran answered 5 years ago

Solution could be to use on_data_display event handler and on getting date value 01-01-1970, replace it with ''
Code would be something like following:

$e["on_data_display"] = array("filter_display", null, true);
$grid->set_events($e);

function filter_display($data)
{
foreach($data["params"] as &$d)
{
foreach($d as $k=>$v)
if ($d[$k] == "01-01-1970")
$d[$k] = "";
}
}

Ad answered 5 years ago

Hello,

I have a bit similar problem about null date from database that will display 01-01-1970 but it is after it has been export to excel file..how can I solve the problem?

Is it the same answer as above? where should I put the code?

Thank you..

Regards,
Ad

Abu Ghufran answered 5 years ago

Yes, same will apply with export. Export uses on_data_display event.
Refer demos/editing/custom-events.php for reference.

Your Answer

3 + 16 =

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 / 5. Vote count:

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

Let us improve this post!