Need Time like 00:00:00 Not Like 2016-07-26 00:00:00

QuestionsNeed Time like 00:00:00 Not Like 2016-07-26 00:00:00
Anand asked 8 years ago

Hi Abu,

When I Use
$col["formatter"] = "datetime";
$col["formatoptions"] = array("srcformat"=>'H:i:s',"newformat"=>'H:i:s',"opts" => array("timeOnly" => true));
I'm getting the result Date and Time ('2016-07-26 00:00:00') but i need only Time ('00:00:00').

Thank you.

4 Answers
Abu Ghufran answered 8 years ago

Try following:

$col["formatter"] = "datetime";
# opts array can have these options: http://trentrichardson.com/examples/timepicker/#tp-options
$col["formatoptions"] = array("srcformat"=>'Y-m-d H:i:s',"newformat"=>'h:i:s A',"opts" => array("timeOnly" => true, "timeFormat"=>"hh:mm:ss tt"));

Abu Ghufran answered 8 years ago

Also refer demos/integration/timepicker.php

Anand answered 8 years ago

Hi Abu,

I tried this. Its working on TIMESTAMP data type. But In my table i have used the datatype TIME so I need TIME value only in INSERT QUERY but its return TIMESTAMP value in INSERT QUERY.

Actual PHPGRID INSERT Query:
INSERT INTO ADMIN."timecheck" ("starttime", "endtime") values ('2016-07-26 05:00:00', '2016-07-26 13:00:00')

Need Like This:
INSERT INTO ADMIN."timecheck" ("starttime", "endtime") values ('05:00:00', '13:00:00')

HERE starttime & endtime DB2 Datatype is TIME.

Abu Ghufran answered 8 years ago

Simple solution without any major change is to connect on_update event handler and split the data part from the field. e.g if posted date column name is 'invdate' then …

$e["on_update"] = array("update_client", null, true);
$g->set_events($e);

function update_client($data)
{
$x = explode(" ",$data["params"]["invdate"]);
$data["params"]["invdate"] = $x[1];
}

Your Answer

8 + 12 =

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?