1

I'm using Time Field to make a field in my event content type for the begin and endtime in of the event. I know that when you outpout the time field via views, you can output it as 24h notation, which works fine. But I want to output the time using php in a tpl file using the row object. So I have php code in my views tpl file that says:

    <?php $uur  = $row->field_field_evenement_uur[0]['rendered']['#time']['value_formatted'];
          $uur .= ' - ';
          $uur .= $row->field_field_evenement_uur[0]['rendered']['#time']['value2_formatted'];  
?>

First thing that came to mind of course was go to admin/structure/types/manage/my_content_type/fields/my_time_field and set the field formatting to 24h notation. It simply looks though like it's not part of the configuration.

Then I debugged my $row output in my view to discover this other way to get a rawer sort of value for the time. This way I would write code like:

$row->field_field_evenement_uur[0]['raw']['value'];

So that would output the time value like 51600. I've been looking for some formatter functions that I could wrap around this value and get me a 24hour notation, even from php.net but it's all seeming like it has to do with the date(); function.

1 Answer 1

1

I totally looked past the display fields part of the field configuration of fields ui. That's exactly where you can set it to output 24hr notation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.