1. 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 ?

Discussion in 'XenForo Development Discussions' started by TBDragon, Feb 28, 2014.

  1. TBDragon

    TBDragon Active Member

    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
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    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 likes this.
  3. TBDragon

    TBDragon Active Member

    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
     
  4. TBDragon

    TBDragon Active Member

    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
     
  5. TBDragon

    TBDragon Active Member

    any help here ?!
     
  6. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  7. TBDragon

    TBDragon Active Member

    God bless u Chris ^_^ thanks
    its work great

    thanks
     

Share This Page