已完成

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

该项目成功由LeonardVoicu ,以 $13 USD的价钱在 天内完成。

为像这样的项目获取免费报价
雇主工作
项目预算
$10 - $30 USD
完成于
1 天
全部竞标
4
项目描述

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"}.

在寻找赚取金钱的机会?

  • 设定您的预算和时间框架
  • 大致描述您的建议方案
  • 为您的工作领取工资

雇用同样在该项目上竞标的威客

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