//------------------------------------------------------------------------------------------------------------------------- /// <summary>Formats the given date time string into the visuallly appealling 1 Jan 2007 23:01:01</summary> public static string PrettyTimeFormat(DateTime date) { string time = null; if (DateTimeInformation.IsNullDate(date) == false) { time = FormatDatabaseDate(date, true, true).Split(new string[] { " " }, StringSplitOptions.None)[1]; } return(time); }
//------------------------------------------------------------------------------------------------------------------------- /// <summary>Formats the given date time string into the visuallly appealling 1 Jan 2007</summary> public static string PrettyDateFormat(DateTime date) { string dateBit = null; if (DateTimeInformation.IsNullDate(date) == false) { dateBit = date.Day + " " + months[date.Month - 1] + " " + date.Year; } return(dateBit); }
//------------------------------------------------------------------------------------------------------------------------- /// <summary>Formats the given date time string into the visuallly appealling 1 Jan 2007</summary> public static string PrettyDateFormat(DateTime date, bool includeDashes) { string dateBit = null; if (DateTimeInformation.IsNullDate(date) == false) { string filler = (includeDashes) ? "-" : " "; dateBit = date.Day + filler + months[date.Month - 1] + filler + date.Year; } return(dateBit); }
//------------------------------------------------------------------------------------------------------------------------- /// <summary>Formats the given date time string into the visuallly appealling 1 Jan 2007</summary> public static string PrettyDateFormat(DateTime date, bool includeDay, bool includeMonth, bool includeYear) { string dateBit = null; if (DateTimeInformation.IsNullDate(date) == false) { dateBit = ((includeDay) ? date.Day + " " : "") + ((includeMonth) ? months[date.Month - 1] + " " : "") + ((includeYear) ? date.Year.ToString() : ""); } return(dateBit); }
//------------------------------------------------------------------------------------------------------------------------- /// <summary>Formats the given date time string into the visuallly appealling 1 Jan 2007 23:01:01</summary> // public static string PrettyDateTimeFormat(DateTime date) { // this one will assume that the timezone offset is zero, but lets leave this blank for now ... // } //------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Formats the given date time string and also appends the UTC timezone differential (e.g. UTC +3.5). /// The timezone offset is derived from the client machine via javascript in the login, passwordRequestReset or passwordReset pages /// And renders the date and time in the visuallly appealling "1 Jan 2007 23:01:01 (UTC +1)" format /// </summary> public static string PrettyDateTimeFormat(DateTime date, int timezoneOffset) { string dateBit = null; if (DateTimeInformation.IsNullDate(date) == false) { // the default if the tz is zero string utcText = TimezoneText(timezoneOffset); string time = FormatDatabaseDate(date, true, true).Split(new string[] { " " }, StringSplitOptions.None)[1]; dateBit = date.Day + " " + months[date.Month - 1] + " " + date.Year + " " + time + " (" + utcText + ")"; } return(dateBit); }