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

Forcing Detailed DateTime in a single spot?

Discussion in 'XenForo Development Discussions' started by Jaxel, Oct 10, 2010.

  1. Jaxel

    Jaxel Well-Known Member

    Right now, if you use: <xen:datetime time="$datetime" /> it will format the date relatively. Which is fine when a date is under a certain date range, in which it shows the time, and then the date relatively. But then when a date gets old enough, it will start listing the date only, and not the time (unless you mouseover). Its kind of varied then, sometimes it shows time and not date, and other times it shows date and not time.

    Basically on a specific spot on my mod, I want to make sure it always shows the time, no matter how old a date. Is there a specific datetime tag to get this done?
     
    Digital Doctor and Trombones13 like this.
  2. Trombones13

    Trombones13 Well-Known Member

    I need this for a simple mod (more like template edit) I'm doing too, and I'm guessing at things--will let you know if I find anything. :)
     
  3. Trombones13

    Trombones13 Well-Known Member

    Sorry to bump this, but does anyone have any ideas? I had no luck with it. :(
     
  4. Kier

    Kier XenForo Developer Staff Member

    I don't have the code in front of me right now, but IIRC, you can use {xen:datetime $datetime, 'absolute'}.
     
    caoanh204 and Trombones13 like this.
  5. Trombones13

    Trombones13 Well-Known Member

    That works; thanks! :D Is there a way to do it with just the time and no date?
     
  6. Kier

    Kier XenForo Developer Staff Member

    {xen:date $datetime, 'absolute'} and {xen:time $datetime, 'absolute'} I think.
     
  7. Trombones13

    Trombones13 Well-Known Member

    Looks like those two remove the entire date/time. :( I tried replacing $datetime and $date and $time, but those don't change the original code.
     
  8. Jeremy

    Jeremy XenForo Moderator Staff Member

    Wouldn't you want to be doing...
    {xen:time $datetime, 'absolute'}
    ... to gain something like 10:42PM?
     
  9. Trombones13

    Trombones13 Well-Known Member

    No; that results in "Oct. 13, 2010 at 10:42PM." "10:42PM" is ultimately what I'd like (the mod I'm referring to is the footer clock) with hovering (like it is now) to show the month/day as well.

    --No, wait; datetime $datetime results in what I wrote. time $datetime causes nothing to show up for whatever reason.
     
  10. Jeremy

    Jeremy XenForo Moderator Staff Member

    Does {xen:data $datetime, 'absolute'} do anything?
     
  11. Trombones13

    Trombones13 Well-Known Member


    Yup; it gives me an error. :p lol
    "The following templates contained errors and were not saved: footer: 1) Line 26: Unknown function: data"
     
  12. Jeremy

    Jeremy XenForo Moderator Staff Member

    Sorry, should have been:
    {xen:date $datetime, 'absolute'}
     
  13. Trombones13

    Trombones13 Well-Known Member

    Already tried that one:
     
  14. Jaxel

    Jaxel Well-Known Member

    Is there any way to do a combination of relative and absolute?

    With relative:
    Today at 1:21 PM
    Yesterday at 1:21 AM
    Oct 30, 2010
    Oct 8, 2010

    With absolute:
    Nov 6, 2010 at 1:21 PM
    Nov 5, 2010 at 3:45 AM
    Oct 30, 2010 at 6:45 PM
    Oct 8, 2010 at 4:30 PM

    WHAT I WANT:
    Today at 1:21 PM
    Yesterday at 1:21 AM
    Oct 30, 2010 at 6:45 PM
    Oct 8, 2010 at 4:30 PM
     
  15. Kier

    Kier XenForo Developer Staff Member

    At present, no that's not possible - if the date is more than a week ago, we figured the time is far less important, so we don't show it when in relative mode.

    I guess that's something we could control with an 'Always show time' option if enough people really wanted it?
     
    Autonamus, Luke F, Andrej and 2 others like this.
  16. CyclingTribe

    CyclingTribe Well-Known Member

    Yes, I'd like this please. (Another thing for the XF to-do list ... lol). :D
     
  17. CyclingTribe

    CyclingTribe Well-Known Member

    I've tried using this in the "post" template but cannot get it to work in 1.1 beta 3 - have the time/date variables changed in 1.1?

    The relative snipped from the 1.1 beta 3 template is:

    PHP:
    <a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="datePermalink"><xen:datetime time="$post.post_date" /></a>
    <xen:datetime time="$post.post_date" /> seems different to the suggested changes above - or am I'm looking in the wrong place?

    Cheers,
    Shaun :D
     
  18. James

    James Well-Known Member

    {xen:time $datetime, 'h:ia'} - does that work? It should return HH:MM(am/pm)
     
  19. Argema

    Argema Member

    Time is a very important thing, I think you should offer the option "always show time". In facts the best way to show the timestamp of a post would be, as Jaxel said:
    Today at 1:21 PM
    Yesterday at 1:21 AM
    Oct 30, 2010 at 6:45 PM
    Oct 8, 2010 at 4:30 PM​

    Anyway,
    <xen:datetime time="$post.post_date" /> seems different to the suggested changes above, I agree with CyclingTribe, and I kindly ask for some clarifications.
    How should I exactly modify <xen:datetime time="$post.post_date" /> in order to show always also the time?
    Thanks in advance.
     
  20. Argema

    Argema Member

Share This Page