sharpiefan (
sharpiefan) wrote in
style_system2010-10-24 06:52 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.png)
Entry tags:
Time/date display for comments
Being British, I don't like the way that the date in comments in my journal is displayed the American way, with the month first. Is there any way of changing it from '10-24-2010' to either '24/10/2010' or '24th Oct 2010'?
no subject
*goes poking* I swear I remember where this is...
It appears that I don't remember where the function is. Dammit! I hope someone replies to this who's smarter than I am on a Sunday.
no subject
So, um, yeah. I know it's possible, at least on Tabula Rasa based layouts. I'll go have a poke.
no subject
I have checked, mine displays wrong as well, I'd never noticed. This must be fixed.
I cannot find it as an option anywhere, which suggests it doesn't exist. I will investigate further.
no subject
no subject
I'd've suggested it myself, but I wanted to be sure I wasn't missing something obvious. :D
no subject
no subject
I could change the date/time display format on my old Flexible Squares layout on LJ and I'm sure it was possible with other layouts too.
no subject
http://www.dreamwidth.org/customize/advanced/layersource?id=97851
Specifically:
##===============================
## Display settings - text
##===============================
propgroup text_child {
property string[] datetime_format_group {
des = "Date and time format";
grouptype = "datetime";
}
set datetime_format_group = ["date_format", "time_format"];
property string date_format {
des = "Date";
values = "%%yyyy%%.%%mm%%.%%dd%%|2010.31.01|%%dd%%.%%mm%%.%%yyyy%%|01.31.2010|%%dd%%.%%mm%%.%%yy%%|01.31.10|%%mm%%.%%dd%%.%%yyyy%%|31.01.2010|%%mm%%.%%dd%%.%%yy%%|31.01.10|long|January 31st, 2010|long_day|Sunday, January 31st, 2010";
grouped = 1;
}
property string time_format {
des = "Time";
values = "short|06:30pm|%%HH%%:%%min%%|18:30";
grouped = 1;
}
property string character_before {
des = "Symbol or character to display before links in modules and before entry metadata";
}
}
set date_format = "%%yyyy%%.%%mm%%.%%dd%%";
set time_format = "short";
set character_before = "♦ ";
But my s2-fu is all out of whack so I can barely recall what I'm looking at there...I'm just thinking it's wrong somehow - but why it would flip UK users US-formatted dates on entries and UK-formatted comments and vice versa for US users is quite beyond me...I'm thinking it's something else going on that isn't in the above code (maybe...I just had to find and copy the code I know of that controls date-time format into one of these comments or I was going to rip my hair out for wanting to look at it).
Gets worse...
Re: Gets worse...
I don't get it. At all.
Re: Gets worse...
Re: Gets worse...
Though I can't say as to the rest.
Re: Gets worse...
Re: Gets worse...
I'm a UK user and the initial post has the date listed as Oct. 24th, 2010 18:52.
Your comment is listed as 2010-10-24 23:25 (local).
Personally, I'd prefer dates to be listed as dddd/mmmm/yyyy, e.g. Monday 25th October 2010.
no subject
Edit: and to answer your question, you need to add this to a theme or a user layer:
function Comment::time_display (string datefmt, string timefmt) : string {
return $this->time_display("med", $timefmt, false);
}
no subject
Out of curiosity, will "non-US formats" also include thing like Jewish, Muslim, Japanese and Chinese calendars?
no subject
no subject
Fair enough - I can imagine a few people would like to have alternative date formats, and/or dual date format displays. IIRC, there's a specific chunk of Perl or PHP coding that does it automatically.
no subject
By "it", I mean convert from Gregorian date formats to others.
Found it for Perl:
http://search.cpan.org/~morty/DateConvert-0.16/Convert.pm
...and for PHP:
http://php.net/manual/en/function.date.php
http://www.php.net/manual/en/calendar.constants.php
no subject
no subject
The format is set to "med". Med is a pre-set format which corresponds to "Oct. 28th, 2010".
no subject
ETA: works like a charm! Lovely to have an answer to the problem I never knew I had until I read the OP - thanks again.