For a wordpress plugin I need the default date format set in options->general. I need the format string (like 'Y-m-d H:i:s') for usage in the Carbon library. In the documentation I didn't find anything related to this.
Date and time formats are stored separately as options.
Use get_option()
to retrieve the value.
E.g.
$date_format = get_option( 'date_format' ); // e.g. "F j, Y"
$time_format = get_option( 'time_format' ); // e.g. "H:i:s"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With