dimanche 31 mai 2020

Created at timestamp is null when retrieve

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



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MeuRaP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire