Welcome to Geeklog, Anonymous Friday, April 26 2024 @ 01:12 am EDT

Geeklog Forums

Default Date Display (aka changing the default story_date display settings)


Status: offline

Hrekum

Forum User
Newbie
Registered: 06/03/03
Posts: 11
stupid
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.
 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.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Instead of guessing, why not try some good ol\' fashioned reading? bye, Dirk
 Quote

Status: offline

Hrekum

Forum User
Newbie
Registered: 06/03/03
Posts: 11
excited
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
 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.
 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 Surprised!) 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 Surprised!) [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 Surprised!( Thanks for any help Regards, Michael
 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:
Text Formatted Code
<?php

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
 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?
 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.
 Quote

All times are EDT. The time is now 01:12 am.

  • 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