Completado

Easy If sentence to change Date Format in Smarty Template for WHMCS

Este proyecto fue completado exitosamente por LeonardVoicu por $13 USD en un día.

Obtén cotizaciones gratis para un proyecto como este
Empleador trabajando
Presupuesto de Proyecto
$10 - $30 USD
Completado En
1 día
Ofertas Totales
4
Descripción del Proyecto

Hello I am using WHMCS as a billing system, which uses Smarty templates to show client area pages.

WHMCS does not provide a way to format the dates according to client country, so I need to find a way to do that, modifying the client area template files.

I already found a way to do it, adding this if sentence inside the template files:

{if $[url removed, login to view] eq "Argentina"}

{$datedue|date_format:"%d/%m/%y"}

{elseif $[url removed, login to view] eq "United States"}

{$datedue|date_format:"%m/%d/%y"}

{else}

{$datedue|date_format:"%m/%d/%y"}

{/if}

But as $datedue is just one of several possible variables for dates, I need to find a way in which I could set just the date format modifier inside the if sentence, and then apply that modifier to each date variable.

Something like this:

{if $[url removed, login to view] eq "Argentina"}

$datelocalformat = "%d/%m/%y"

{elseif $[url removed, login to view] eq "United States"}

$datelocalformat = "%m/%d/%y"

{else}

$datelocalformat = "%m/%d/%y"

{/if}

{$datedue|date_format:"$datelocalformat"}

So basically I need to know what expressions should I use instead of $datelocalformat = "%m/%d/%y" inside the if statement, and then what to use instead of {$datedue|date_format:"$datelocalformat"}.

Buscando hacer algo de dinero?

  • Establece tu presupuesto y período de tiempo
  • Describe tu propuesta
  • Consigue pago por tu trabajo

Contrata Freelancers que también oferten en este proyecto

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online