I am saving data using sensor where data is coming like this
$input = $request["date"].' '.$request["time"];
$newDate= DateTime::createFromFormat('d/m/Y H:i:s',$input);
$created_date = $newDate->format('Y-m-d H:i:s'); // for example
try{
$SensorData = SensorData::create([
'sensor_id' => $request['sensor']['id'],
'created_at' => "".$created_date."",
]);
$sensor_data=SensorData::join('sensors','sensors.id','=','sensor_id')->orderBy('sensor_data.created_at','DESC')->get();
its saving datetime in database as 2020-05-04 01:10:12
but when retrieve value it shows null
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire