Forums / General Questions / Could anyone tell me how to format the

Could anyone tell me how to format the

Views: 525

Results 1 to 3 of 3
29 Apr 2015, 8:10 PM
#1
suedouglas avatar

suedouglas

New Zenner

Join Date:
Nov 2008
Posts:
45
Plugin Contributions:
0

Could anyone tell me how to format the

This coding below I've put in /public_html/includes/templates/mytemplate/templates/tpl_product_info_display.php

<div id="productDateAdded" class="productGeneral biggerText"><strong>Date Added: </strong><?php echo $products_date_added; ?>

Currently it's coming on the product displayonmy website as YYYY-MM_DD HH:MI:SS I'd like it just to display the date (not the time) in UK format i.e. 'DD-MM-YYYY' (I've already changed all the date formats to the UK format using Picaflor Azul's tutorial)

Could anyone help please?

29 Apr 2015, 8:31 PM
#2
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: Could anyone tell me how to format the

suedouglas:

This coding below I've put in /public_html/includes/templates/mytemplate/templates/tpl_product_info_display.php

<div id="productDateAdded" class="productGeneral biggerText"><strong>Date Added: </strong><?php echo $products_date_added; ?>

Currently it's coming on the product displayonmy website as YYYY-MM_DD HH:MI:SS I'd like it just to display the date (not the time) in UK format i.e. 'DD-MM-YYYY' (I've already changed all the date formats to the UK format using Picaflor Azul's tutorial)

Could anyone help please?

There are two function built in

zen_date_long() & zen_date_short()

That uses the following constants located in includes/languages/english.php or the override for that includes/languages/YOUR_TEMPALTE/english.php

  define('DATE_FORMAT_SHORT', '%m/%d/%Y');
  define('DATE_FORMAT_LONG', '%A %d %B, %Y');

You can format those the way you wish than use that function on the date like so:

Change the constant to:

define('DATE_FORMAT_SHORT', '%d/%m/%Y');

and in your:
/public_html/includes/templates/mytemplate/templates/tpl_product_info_display.php
Change:

<?php echo $products_date_added; ?>

to:

<?php echo zen_date_short($products_date_added); ?>
29 Apr 2015, 8:38 PM
#3
suedouglas avatar

suedouglas

New Zenner

Join Date:
Nov 2008
Posts:
45
Plugin Contributions:
0

Re: Could anyone tell me how to format the

bislewl:

There are two function built in

zen_date_long() & zen_date_short()

That uses the following constants located in includes/languages/english.php or the override for that includes/languages/YOUR_TEMPALTE/english.php

define('DATE_FORMAT_SHORT', '%m/%d/%Y');
define('DATE_FORMAT_LONG', '%A %d %B, %Y');

> 
> 
> You can format those the way you wish than use that function on the date like so:
> 
> Change the constant to:
>  ```php
define('DATE_FORMAT_SHORT', '%d/%m/%Y');

and in your:
/public_html/includes/templates/mytemplate/templates/tpl_product_info_display.php
Change:

<?php echo $products_date_added; ?>
> to:
> ```php
<?php echo zen_date_short($products_date_added); ?>

Thanks that worked a treat. I had tried the zen_short but obviously had the wrong syntax!
Thank you so much for your help I've been struggling with it for about 3 hours trying this that and the other!!