Jump to content



Photo
- - - - -

insert date order in invoice.php


  • Please log in to reply
1 reply to this topic

#1   bkiani

bkiani
  • Members
  • 81 posts
  • Real Name:bKiani
  • Gender:Male
  • Location:Iran

Posted 11 August 2016 - 06:07

Hello
I was in my invoice indicating the date of the order

 

I added this code in (invoice.php) file

 

<td class="main"><strong><?php echo TEXT_DATE_ORDER_CREATED; ?></strong></td>
        <td class="main"><?php echo $order->info['date_purchased']; ?></td>

 

Gregorian date to be inserted

But do not know how I turned to the jalali date

 

using 2.3.4 ver

 

please help me



#2   MrPhil

MrPhil
  • Members
  • 7,012 posts
  • Real Name:Phil
  • Gender:Male

Posted 11 August 2016 - 16:13

If $order->info['date_purchased'] is a string with a Western (Gregorian) format date, and you want to display it as Jalali format, you would have to find a conversion routine and add it to your code (both the function and wrapping a call to this function around that string). http://www.phpclasse...li-formats.html might be useful to you. I don't think there's anything built in to PHP to directly do such formatting or conversion, but it wouldn't hurt to do a quick search.

 

Keep in mind that if you have customers outside Iran/Afghanistan who might be using your page and would prefer Gregorian dates, to make the conversion conditional on some sort of switch.


Edited by MrPhil, 11 August 2016 - 16:14.