The PHP Date toUnix function is used to convert a given date in a specific format to Unix timestamp. Unix timestamp is the number of seconds that have elapsed since January 1, 1970, at 00:00:00 UTC.
Example: Suppose you have a date string “2021-10-01 05:30:00” and you want to convert it to Unix timestamp. Here’s how you can do it using the Date toUnix function:
In this example, we use the PHP strtotime function to convert the date string to a Unix timestamp. The function returns the number of seconds since 01-01-1970.
The package library for the Date toUnix function is included in the core PHP date library. It is a built-in library function and does not require any external packages or libraries.
PHP Date::toUnix - 18 examples found. These are the top rated real world PHP examples of Date::toUnix from package googleads-php-lib extracted from open source projects. You can rate examples to help us improve the quality of examples.