Home / PHP Tips Generated By ChatGPT / Converting a String to Date and Time in PHP Use strtotime() to convert a string into a Unix timestamp, then format it with date(). Source Code $dateString = "next Thursday"; $timestamp = strtotime($dateString); echo date("Y-m-d", $timestamp);