GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-time-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default time field output template.
4  *
5  * @global \GV\Template_Context $gravityview
6  * @since 2.0
7  */
8 
9 if ( ! isset( $gravityview ) || empty( $gravityview->template ) ) {
10  gravityview()->log->error( '{file} template loaded without context', array( 'file' => __FILE__ ) );
11  return;
12 }
13 
14 $field_id = $gravityview->field->ID;
15 $field = $gravityview->field->field;
16 $value = $gravityview->value;
17 
18 // strtotime() fails at "00:00 am"; it returns false instead of midnight.
19 if ( false !== strpos( $value, '00:00' ) ) {
20  $value = '00:00';
21 }
22 
23 $output = '';
24 
25 if ( '' !== $value ) {
26 
27  $format = $gravityview->field->date_display;
28 
29  if ( empty( $format ) ) {
30 
31  $field->sanitize_settings();
32 
34  }
35 
36  // If there is a custom PHP date format passed via the date_display setting, use PHP's date format
37  $output = date_i18n( $format, strtotime( $value ) );
38 }
39 
40 echo $output;
if(gv_empty( $field['value'], false, false)) $format
if(false !==strpos( $value, '00:00')) $output
gravityview()
The main GravityView wrapper function.
if(! isset( $gravityview)||empty( $gravityview->template)) $field_id
The default time field output template.
static date_format( $time_format='12', $field_id=0)
Get the default date format for a field based on the field ID and the time format setting...