JackieChun Well-known member Jun 30, 2015 #1 How can I edit $user.register_date to show month and year only? I only want this change enabled in the postbit, so I'm only editing one template.
How can I edit $user.register_date to show month and year only? I only want this change enabled in the postbit, so I'm only editing one template.
JackieChun Well-known member Jun 30, 2015 #4 Ah, but that kills the feature that shows the date as "Friday" etc, if the member joined less than a few days ago. Any way to keep both features? Upvote 0 Downvote
Ah, but that kills the feature that shows the date as "Friday" etc, if the member joined less than a few days ago. Any way to keep both features?
V Valhalla Well-known member Jun 30, 2015 #5 You could use this, in place of what I posted above: Code: {xen:if '{$user.register_date} < {xen:calc '{$serverTime} - 86400 * 7'}', '{xen:date $user.register_date, 'M Y'}', '{xen:date $user.register_date}'} Upvote 1 Downvote
You could use this, in place of what I posted above: Code: {xen:if '{$user.register_date} < {xen:calc '{$serverTime} - 86400 * 7'}', '{xen:date $user.register_date, 'M Y'}', '{xen:date $user.register_date}'}
JackieChun Well-known member Jun 30, 2015 #6 Thanks. I might leave your earlier version. This seems like an unnecessary extra query, and I don't want to overload the server. Upvote 0 Downvote
Thanks. I might leave your earlier version. This seems like an unnecessary extra query, and I don't want to overload the server.
P Paul B XenForo moderator Staff member Jun 30, 2015 #7 There is no additional query involved in that code - the data is already exposed to the template, it is just being manipulated based on a condition. Upvote 0 Downvote
There is no additional query involved in that code - the data is already exposed to the template, it is just being manipulated based on a condition.
JackieChun Well-known member Jul 1, 2015 #8 The new version of the code seems to be working great. Thank you guys! Upvote 0 Downvote
JackieChun Well-known member Sep 1, 2019 #9 Hi @Valhalla, the code gives a syntax error in XenForo 2.1. Do you know how to update it? Upvote 2 Downvote
R Robert9 Well-known member Aug 29, 2022 #10 I tried m and M, but i want to have the whole month as a word like January. What can use for that, please? Upvote 0 Downvote
I tried m and M, but i want to have the whole month as a word like January. What can use for that, please?