• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

how to change the RM date format to DATE ?

TBDragon

Active member
#1
hi every one
i just wana display the date published of my resources but !!

the resource_date field are int !! and the format of the value a number which i didnt know how to deal with or how to convert it to a date format so its displayed in normal way like in threads !!

Fri, 28 Feb 2014 22:50:17 +0000
but i with RM resource_date field i got this
1393522156
 

Chris D

XenForo developer
Staff member
#2
In templates, you can use:

HTML:
<xen:datetime time="$intDate" class="time" />
Where $intDate is the time in an integer format.

In PHP you can use:
PHP:
XenForo_Locale::dateTime($intDate);
Again, where $intDate is the time in integer format.
 

TBDragon

Active member
#3
In templates, you can use:

HTML:
<xen:datetime time="$intDate" class="time" />
Where $intDate is the time in an integer format.

In PHP you can use:
PHP:
XenForo_Locale::dateTime($intDate);
Again, where $intDate is the time in integer format.
thanks

i use the code but its didnt do much =(

i put the code in a controller
>> its FireDaemon ResourceManager Rss addon

as the RSS format somehow r not valid as there is no pubDate tags

so i try to play around with it and put this


but i got this

Use of undefined constant resource_date - assumed 'resource_date'

PHP:
      for($i=0;$i<$a;$i++)
        {
            $b = $qs1[$i];
            $date = $b[resource_date] ;
            echo "<item>
              <title>$b[title]</title>
              <pubDate>".XenForo_Locale::dateTime($date)."</pubDate>
              <link>http://$newurlstr1$b[resource_id]/</link>
              <guid>http://$newurlstr1$b[resource_id]/</guid>
              <description>$b[tag_line]</description>
            </item>";
        }
sorry to bother u and thanks again for helping
 

TBDragon

Active member
#4
i fond the issue thanks
i just forget to put ' '

+

the output dosent show the same format of this

Fri, 28 Feb 2014 22:50:17 +0000


its show

Friday in 21:29 << its show the day and time no month or day =(

is there other option to format the date

and thanks
 

Chris D

XenForo developer
Staff member
#6
I think you can change this:
PHP:
XenForo_Locale::dateTime($date)
To:
PHP:
XenForo_Locale::dateTime($date, 'absolute')
That's from memory, I haven't tested it.