• 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?

Jaxel

Well-known member
#1
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?
 

Trombones13

Well-known member
#2
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?
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. :)
 

Trombones13

Well-known member
#9
Wouldn't you want to be doing...
{xen:time $datetime, 'absolute'}
... to gain something like 10:42PM?
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.
 

Jaxel

Well-known member
#14
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
 

Kier

XenForo Developer
Staff member
#15
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
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?
 

CyclingTribe

Well-known member
#17
I don't have the code in front of me right now, but IIRC, you can use {xen:datetime $datetime, 'absolute'}.
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
 

James

Well-known member
#18
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.
{xen:time $datetime, 'h:ia'} - does that work? It should return HH:MM(am/pm)
 
#19
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?
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