muazzamazaz
4 months ago

Created at timestamp is null when retrieve

Posted 4 months ago by muazzamazaz

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."",

          
        ]);

its saving datetime in database as 2020-05-04 01:10:12 but when retrieve value it shows null

Please sign in or create an account to participate in this conversation.