httpDateFormat property

String get httpDateFormat

Format a date to "DAY, DD MON YYYY hh:mm:ss GMT" according to RFC-1123, e.g. Thu, 1 Jan 1970 00:00:00 GMT.

Implementation

String get httpDateFormat {
  final weekday = smallWeekdays[this.weekday];
  final month = smallMonthsNames[this.month];
  final d = toUtc();
  final sb = StringBuffer()
    ..write(weekday)
    ..write(', ')
    ..write(d.day <= 9 ? '0' : '')
    ..write(d.day)
    ..write(' ')
    ..write(month)
    ..write(' ')
    ..write(d.year)
    ..write(d.hour <= 9 ? ' 0' : ' ')
    ..write(d.hour)
    ..write(d.minute <= 9 ? ':0' : ':')
    ..write(d.minute)
    ..write(d.second <= 9 ? ':0' : ':')
    ..write(d.second)
    ..write(' GMT');

  return sb.toString();
}