Convert a string to a integer

Published 2 months ago by sami2500

The input date value is displayed as follows

"2014-10-20"

I want to be numeric so that the converting function can be registered in the table

2014-10-20
joshuafranks

If you're wanting to convert it to a Carbon instance, you can just use Carbon's parse() method:

Carbon::parse("2014-10-20")

That will return a Carbon instance of the date provided.

sami2500

@joshuafranks code:

      $dt = Carbon::now()->toDateString();
      $ly=Alert::where('ext_date','=',$dt)->pluck('msg');
var_dump($dt);

output

string(10) "2018-06-23"

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