in the shoutbox, how to change it from saying
Friday, October21 2009, 4:54pm MidwestSS:
to just 4:54pm MidwestSS:
?
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:
/// <summary>
/// Formats a datetime value into time only 5:25 PM
/// </summary>
/// <param name="o">
/// This formats the date.
/// </param>
/// <returns>
/// Short formatted date.
/// </returns>
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");
}
}
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
<Resource tag="FORMAT_TIME_ONLY">h:mm tt</Resource>
to the language.xml file under the "COMMON" page.
Edited by user
14 years ago
|
Reason: didn't take into account the admin setting for displaying date/time formats