Skip to content

Instantly share code, notes, and snippets.

@tahafarooqui
Last active January 12, 2018 19:36
Show Gist options
  • Save tahafarooqui/656bf7efc9a81f104293a53ce743c617 to your computer and use it in GitHub Desktop.
Save tahafarooqui/656bf7efc9a81f104293a53ce743c617 to your computer and use it in GitHub Desktop.
PHP Unix Date Insert, Update
// Static
$checkIN = $this->input->post('checkIN');
$checkIN = str_replace("/", "-", $checkIN);
$checkIN = date('Y-m-d h:i:s', strtotime($checkIN));
$checkOUT = $this->input->post('checkOUT');
$checkOUT = str_replace("/", "-", $checkOUT);
$checkOUT = date('Y-m-d h:i:s', strtotime($checkOUT));
//Dynamic in for loop
$checkIN[$key] = $this->input->post('checkIN')[$key];
$checkIN[$key] = str_replace("/", "-", $checkIN[$key]);
$checkIN[$key] = date('Y-m-d h:i:s', strtotime($checkIN[$key]));
$checkOUT[$key] = $this->input->post('checkOUT')[$key];
$checkOUT[$key] = str_replace("/", "-", $checkOUT[$key]);
$checkOUT[$key] = date('Y-m-d h:i:s', strtotime($checkOUT[$key]));
//GET Date with Format
<?php echo date('d-m-Y',strtotime($singlelistva['passenger_checkout']));?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment