Function Reference: geodir_imex_get_date_ymd
Summary
Convert date format to store in database.
Description
PHP date() function doesn’t work well with d/m/Y format
so this function validate and convert date to store in db.
Package
GeoDirectory
Parameters
- $date
- (string) (required) Date in Y-m-d or d/m/Y format.
- Default: None
Return Values
- (string)
- Date in Y-m-d format.
Change Log
Since: 1.5.1
Source File
geodir_imex_get_date_ymd() is located in geodirectory-admin/admin_functions.php [Line: 5947]
Source Code
function geodir_imex_get_date_ymd($date) { if (strpos($date, '/') !== false) { $date = str_replace('/', '-', $date); // PHP doesn't work well with dd/mm/yyyy format. } $date = date_i18n('Y-m-d', strtotime($date)); return $date; }