In PHP, the most common and straightforward method to convert datetime strings to timestamps is by using the strtotime() function. So even when this seems like a pointless exercise, you might actually end up using it if you are using a third party library or API that reads string time into strtotime() function. The benefit of timestamp is that it's timezone neutral.
Source code viewer
// Use @timestamp format directly for datetime_string $timestamp = 1612690800; // Unix timestamp $datetime_string = '@' . $timestamp; Programming Language: PHP