strtotime instead of strftime function - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8) +--- Thread: strtotime instead of strftime function (/showthread.php?tid=1028) |
strtotime instead of strftime function - yojoe - 2010-10-06 hello After investigating JP's problem described in this thread http://get-simple.info/forum/topic/1074/setlocale-in-gsconfigphp-date-is-not-correct/ I wonder why GS utilizes strtotime, instead of strftime function + eventually iconv function (for UTF-8 encoding), as it is capable to show date only in US English format. There's no problem if somebody wants to show date using digits, but localized textual representation of days, and months will be shown only in english. I know that my solution isn't perfect, and strftime should use a declared variable (maybe even being able to be set in admin panel). But I'm almost falling asleep on my keyboard, and just wanted to let you know about that. My solution is working, although not all steps mentioned are needed to succeed . strtotime instead of strftime function - yojoe - 2010-11-02 Could anyone confirm if this problem still occur or has been fixed in latest 2.03/2.04 build ? strtotime instead of strftime function - ccagle8 - 2010-11-03 i dont think it has... submit a patch if you can, and we will look into what it will take to get it in... Thanks! strtotime instead of strftime function - yojoe - 2010-11-03 I'm messing with 2.04, and I see an additional bug. Look at the attached image. I use polish language file, but I still see on the sites "permalink", ant "last saved" phrases words, even when LAST_SAVED variable (line 87) is translated to polish language. There's no var to translate "permalink" thou. About main problem with date, variables inside translation file "DATE_FORMAT" => "j.m.Y", //please keep short "DATE_AND_TIME_FORMAT" => "j.m.Y - G:i", //date and time are used only in admin panel, to show page creation/save date, and aren't used to show date of last page save. I posted a way how to set own date format in first post of this thread. Basically there's only 1 thing to change inside theme_functions.php file. $myVar = date($i, strtotime($date)); -> $myVar = iconv("", "UTF-8",strftime('%A, %e.%B. %Y')); (in earlier versions of GS the date was echo'ed, now it's attached to $myvar) This is more a temporary fix, as the date format should be loaded from translation file, not hardcoded in .php file, because in different countries date is displayed in their own format. In Poland it's day.month.year, while in for example US its month-day-year (afair). It works for me, but other users, who would like to display the date on pages in their own taste, have to edit core files. I'm afraid I can't provide a better solution using a dedicated variable in language file, due to my poor php knowledge |