nf_get_end_date

Return the end date with an added 23:59:59.

Description

(string) nf_get_end_date( (string) $end_date ); 

Checks for the current date format setting and tries to respect it.

Returns (string)

$end_date

Parameters (1)

0. $end_date (string)
The end date.

Usage

  1. if ( !function_exists( 'nf_get_end_date' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/functions.php'; 
  3.  
  4. // The end date. 
  5. $end_date = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = nf_get_end_date($end_date); 
  9.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/functions.php  
  1. function nf_get_end_date( $end_date ) { 
  2. $plugin_settings = nf_get_settings(); 
  3.  
  4. if ( isset ( $plugin_settings['date_format'] ) ) { 
  5. $date_format = $plugin_settings['date_format']; 
  6. } else { 
  7. $date_format = 'm/d/Y'; 
  8.  
  9. if ( $date_format == 'd/m/Y' ) { 
  10. $end_date = str_replace( '/', '-', $end_date ); 
  11. } else if ( $date_format == 'm-d-Y' ) { 
  12. $end_date = str_replace( '-', '/', $end_date ); 
  13. $end_date .= '23:59:59'; 
  14. $end_date = new DateTime( $end_date ); 
  15.  
  16. return $end_date;