reply

Home Forums Responsive Themes Directory Theme days open hours is showing military time instead of normal time. how to change? Reply To: days open hours is showing military time instead of normal time. how to change?

  • JamesD
    JamesD
    July 12, 2019 at 4:12 am

    @mark

    Here is a way you could at least change it on the website listing using the child theme method:
    In your child theme directory create a folder called widgets.

    Place a copy of /DT9/_directory/ into this directory.
    Now, open the the and replace line #115:
    <span><?php echo date('H:i A', strtotime($bh['start'][$i])); ?> - <?php echo date('H:i A', strtotime($bh['end'][$i])); ?></span>
    With
    <span><?php echo date('h:i A', strtotime($bh['start'][$i])); ?> - <?php echo date('h:i A', strtotime($bh['end'][$i])); ?></span>

    Next we need to change the path to call the child theme file instead of the default.

    Place a copy of /DT9/_ into your child theme directory (if the file doesn’t already exist).

    Open the file and replace line #51:
    <?php get_template_part( '_directory/widgets/widget', 'openinghours' ); ?>
    With
    <?php get_template_part( 'widgets/widget', 'openinghours' ); ?>

    Those steps should change the display on the listings to a 12 hour format without altering any core files.

    Note: Formatting can be changed where you see the date function with the settings like h:i A. Capital ‘H’ is the 24 hour format while small ‘h’ is 12 hour format. More formatting details can be found HERE.

    Haven’t found a good way to handle the changes within the adding/editing listing form. That code is in the file.