YAFLogo

Posted by: midwestSS - Friday, 20 November 2009 09:46:25
in the shoutbox, how to change it from saying Friday, October21 2009, 4:54pm MidwestSS: to just 4:54pm MidwestSS: ?

Posted by: chriscoe71 - Sunday, 22 November 2009 02:02:18
[quote=midwestSS]in the shoutbox, how to change it from saying Friday, October21 2009, 4:54pm MidwestSS: to just 4:54pm MidwestSS: ?[/quote] I'm not sure if this is the easiest or the cleanest way, but you could, assuming you are working off the entire code base, add another method to Yaf.Classes.Core > Services > YafDateTime.cs and call it from /Controls/ShoutBox.ascx The method could look something like: [code] /// /// Formats a datetime value into time only 5:25 PM /// /// /// This formats the date. /// /// /// Short formatted date. /// public string FormatTimeOnly(object o) { DateTime dt = (DateTime)o + TimeOffset; try { if (YafContext.Current.BoardSettings.DateFormatFromLanguage) { return YafContext.Current.Localization.FormatDateTime(YafContext.Current.Localization.GetText("FORMAT_TIME_ONLY"), dt); } else { return String.Format("{0:h:mm tt}", dt); } } catch (Exception) { return dt.ToString("h:mm tt"); } }[/code] Recompile the code. Then, on line 58 of /Controls/ShoutBox.ascx change YafServices.DateTime.FormatDateTimeTopic to YafServices.DateTime.FormatTimeOnly To account for date formats being chosen from the language file, you would also need to add [code]h:mm tt[/code] to the language.xml file under the "COMMON" page.

Posted by: Kamyar - Sunday, 22 November 2009 11:00:37
In Controls/Shoutbox.ascx: Replace this: [code][/code] With this: [code][/code] Although it's not exactly what you want (Shows seconds) but if that's not a big deal for you then it's an easy way.

Posted by: chriscoe71 - Sunday, 22 November 2009 12:31:40
Kamyar's way requires a lot less coding. The method I put up removed the seconds from the display.