Welcome to Geeklog, Anonymous Tuesday, March 25 2025 @ 03:33 pm EDT
Geeklog Forums
Default Date Display (aka changing the default story_date display settings)
I feel like I have missed something very obvious, but I am clearly missing it. If I log into my site, I can change my Display Options and change the format of the datetime settings. I managed to add a new type to the table, but how on earth can I globally change the format so it will be that way for all users? I would love to be able to just change the story_date format... please help.
12
11
Quote
Interested
Anonymous
Looks like you can change this in the config.php file.
This guy right here should do it, I think.
$_CONF[\'date\'] = \'%A, %B %d %Y @ %I:%M %p %Z\';
%A = Day of the week?
%B = Month (perhaps?)
%d = numeric day of month?
%Y = year?
%I = hour?
%M = minute?
%p = am or pm?
%Z = zone?
I\'d just fiddle around with this and see what happens.
13
12
Quote
Hi Dirk
I had referenced the documentation previously, but I didn\'t see anything that explicitly told me what I needed to change. So I guess my next two questions are:
1. Does changing the format of $_CONF[\'date\'] in the config.php file change all date formats on the site, including \'story_date\'?
2. Is there any way of just changing the \'story_date\' format?
Thanks for your help and praise be to you and the team for creating such a great product.
Cheers
Chris
14
12
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The \'story_date\' variable is formatted using $_CONF[\'date\'], unless the user has selected a date format other than \"System Default\" in his/her preferences.
Which date/time formatting is used where isn\'t really documented. If in doubt, you will have to look it up in the source ...
bye, Dirk
P.S. My \"instead of guessing\" comment was really addressed at \'Interested\'. The list of \'%\' formatting strings is copied straight out of the PHP manual, btw.
17
13
Quote
Michael
Anonymous
Hi all,
i also have a problem with date - or date translation.
I\'m tring to set op GL on a site - so i\'m a rookie in GL
)
On the frontpage (and in the stories) the date (date and month) is always english - and i have edited in the config.php (se below) and \'installed\' the danish language-pack
)
[cut]
/ +---------------------------------------------------------------------------+
// | LOCALE SETTINGS |
// +---------------------------------------------------------------------------+
$_CONF[\'language\'] = \'danish\';
$_CONF[\'locale\'] = \'da-DK\';
$_CONF[\'date\'] = \'%A, %d. %B %Y @ %H:%M\';
$_CONF[\'daytime\'] = \'%%d/%m %H:%M\';
$_CONF[\'shortdate\'] = \'%x\';
$_CONF[\'dateonly\'] = \'%d-%b\';
$_CONF[\'timeonly\'] = \'%H:%M\';
$_CONF[\'default_charset\'] = \'iso-8859-1\';
$_CONF[\'rdf_language\'] = \'da-DK\'; // may have to be different than the locale
[end cut]
I have set up the date in Danish format and would like it also to display the name of the day and month in Danish. According to my Webhotel they have added AddLanguage da .dk in Apache.
Isn\'t in Apache the locale is set and is the syntax i wrote not correct??
I\'ve also tried \'da_DK\' and \'da.DK\' without luck
(
Thanks for any help
Regards,
Michael



14
20
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Try this little script to see if your server supports switching to the Danish locale:
echo "<p>Default date format: " . strftime ("%A, %x");
$result = setlocale (LC_ALL, 'da_DK');
if ($result === false) {
echo "<p>Error when changing locale";
} else {
echo "<p>Switched to locale $result, date format is now: ";
echo strftime ("%A, %x");
}
?>
If you get an "Error when changing locale" then you should contact your hosting service ...
bye, Dirk
Text Formatted Code
<?phpecho "<p>Default date format: " . strftime ("%A, %x");
$result = setlocale (LC_ALL, 'da_DK');
if ($result === false) {
echo "<p>Error when changing locale";
} else {
echo "<p>Switched to locale $result, date format is now: ";
echo strftime ("%A, %x");
}
?>
17
11
Quote
t.bag
Anonymous
There is a list of possible date formats in the display preferences (dropdown) How can I add other formats to it i.e. where is this list stored?
12
16
Quote
t.bag
Anonymous
Got it, you just have to add the new format in the corresponding MySQL table (gb_dateformats) in case anyone wants to know.
14
12
Quote
All times are EDT. The time is now 03:33 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content