public static string getTimeStringForDateTime(cape.DateTime dd, bool includeTimeZone = false) { if (!(dd != null)) { return("NOTIME"); } var sb = new cape.StringBuilder(); sb.append(cape.String.forIntegerWithPadding(dd.getHours(), 2, "0")); sb.append(':'); sb.append(cape.String.forIntegerWithPadding(dd.getMinutes(), 2, "0")); sb.append(':'); sb.append(cape.String.forIntegerWithPadding(dd.getSeconds(), 2, "0")); if (includeTimeZone) { sb.append(" GMT"); } return(sb.toString()); }
public static string forDateTime(cape.DateTime dd) { if (!(dd != null)) { return("NODATE"); } var sb = new cape.StringBuilder(); sb.append(capex.text.VerboseDateTimeString.getShortDayName(dd.getWeekDay())); sb.append(", "); sb.append(cape.String.forIntegerWithPadding(dd.getDayOfMonth(), 2, "0")); sb.append(' '); sb.append(capex.text.VerboseDateTimeString.getShortMonthName(dd.getMonth())); sb.append(' '); sb.append(cape.String.forInteger(dd.getYear())); sb.append(' '); sb.append(cape.String.forIntegerWithPadding(dd.getHours(), 2, "0")); sb.append(':'); sb.append(cape.String.forIntegerWithPadding(dd.getMinutes(), 2, "0")); sb.append(':'); sb.append(cape.String.forIntegerWithPadding(dd.getSeconds(), 2, "0")); sb.append(" GMT"); return(sb.toString()); }