Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert this string to timestamp PHP [duplicate]

Tags:

People also ask

How to change string to timestamp PHP?

The strtotime() function is a built-in function in PHP which is used to convert an English textual date-time description to a UNIX timestamp. The function accepts a string parameter in English which represents the description of date-time. For e.g., “now” refers to the current date in English date-time description.

How to use strtotime PHP?

If you want to use the PHP function strtotime to add or subtract a number of days, weeks, months or years from a date other than the current time, you can do it by passing the second optional parameter to the strtotime() function, or by adding it into the string which defines the time to parse.

How to convert time to Unix timestamp PHP?

Converting datetime strings to a Unix timestampA combination of two PHP functions, the strtotime() and the date() functions, will produce an output like the one shown in the image above. The strtotime() function converts any given date string into a Unix timestamp. It only accepts the date string as a parameter.

How do you convert a string to a carbon date?

$date = Carbon\Carbon::parse($rawDate); well thats it. You'll now have a Carbon instance & you can format the date as you like using Carbon helper functions.


I have this string: "13/10 15:00" and I would like to convert it to timestamp but when I do this:

      $timestamp = strtotime("13/10 15:00"); 

It returns an empty value.