Change the output format of Date/Time attribute
Permalink
While adding the Date/Time attribute and setting the Date/Time Options as date only, the output i'm getting is like "Date: 2015-03-06 00:00:00". How to remove the time being printed. please help. I have another field for specific times. please help.
Thanks for the reply hutman
I'm using 5.6.
it is printed in the receipt mail of core commerce. i'm new to concrete5 and i dont know how to change.
the code which print the details are
or
is there any way i can modify the format of attribute in the above code itself.
can you please help me with this?
Thanks
I'm using 5.6.
it is printed in the receipt mail of core commerce. i'm new to concrete5 and i dont know how to change.
the code which print the details are
foreach($products as $i => $product) { $keyValues = array(); foreach($product['attributes'] as $key => $attr) { $keyValues[] = "{$key}: {$attr}"; } $prod_img = '-'; if($product['object']) { $img_obj = $product['object']->getProductThumbnailImageObject(); if(is_object($img_obj)) { $img_url = $img_obj->getRelativePath(); if($img_url) { $prod_img = '<img src="'.BASE_URL.$img_url.'" width="70" />'; } } }
Viewing 15 lines of 17 lines. View entire code block.
or
is there any way i can modify the format of attribute in the above code itself.
can you please help me with this?
Thanks
Have you looked at possibly changing the date and time formats using the config/site.php
It is discussed here and quite a few other places.
http://www.concrete5.org/community/forums/installation/timeformat-i...
It is discussed here and quite a few other places.
http://www.concrete5.org/community/forums/installation/timeformat-i...
Thanks studio108,
But i've tried all these things, yet not succeded!
But i've tried all these things, yet not succeded!
Can you provide a screen shot of which date on the receipt you are talking about, what version of the eCommerce add-on you are using and if this date is a product attribute or a customer option?
I've added a attribute under shipping in the Order Attributes in ecommerce settings.
If you only need to fix this in the receipt email you can change /packages/core_commerce/mail/receipt.php and add
into the loop of the shipping_attrs (around line 65 in the one I'm looking at) and that will remove the time portion of that value before it's printed.
Doesn't answer why it still shows, but at least it will fix the problem you're having.
if (strpos($val, ' 00:00:00') !== false) { $val = str_replace(' 00:00:00', '', $val); }
into the loop of the shipping_attrs (around line 65 in the one I'm looking at) and that will remove the time portion of that value before it's printed.
Doesn't answer why it still shows, but at least it will fix the problem you're having.
Thanks for your reply.
But i've done it in other way.
But i've done it in other way.
Have the same problem - but use 5.7
Any idea how I can solve it there?
Torsten
Any idea how I can solve it there?
Torsten
What is the current code you are using to output the date?