nf_get_begin_date
Return the begin date with an added 00:00:00.
Description
(string) nf_get_begin_date( (string) $begin_date );
Checks for the current date format setting and tries to respect it.
Returns (string)
$begin_date
Parameters (1)
- 0. $begin_date (string)
- The begin date.
Usage
if ( !function_exists( 'nf_get_begin_date' ) ) { require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/functions.php'; } // The begin date. $begin_date = ''; // NOTICE! Understand what this does before running. $result = nf_get_begin_date($begin_date);
Defined (1)
The function is defined in the following location(s).
- /deprecated/includes/functions.php
- function nf_get_begin_date( $begin_date ) {
- $plugin_settings = nf_get_settings();
- if ( isset ( $plugin_settings['date_format'] ) ) {
- $date_format = $plugin_settings['date_format'];
- } else {
- $date_format = 'm/d/Y';
- }
- if ( $date_format == 'd/m/Y' ) {
- $begin_date = str_replace( '/', '-', $begin_date );
- } else if ( $date_format == 'm-d-Y' ) {
- $begin_date = str_replace( '-', '/', $begin_date );
- }
- $begin_date .= '00:00:00';
- $begin_date = new DateTime( $begin_date );
- return $begin_date;
- }