kformatF method

String kformatF(
  1. String format
)

日期 format 转换格式,自定义转换格式

Implementation

String kformatF(String format) {
  var file = this;
  if (format.contains('yy')) {
    String year = file.year.toString();
    if (format.contains('yyyy')) {
      format = format.replaceAll('yyyy', year);
    } else {
      format = format.replaceAll(
          'yy', year.substring(year.length - 2, year.length));
    }
  }
  format = _comformat(file.month, format, 'M', 'MM');
  format = _comformat(file.day, format, 'd', 'dd');
  format = _comformat(file.hour, format, 'H', 'HH');
  format = _comformat(file.minute, format, 'm', 'mm');
  format = _comformat(file.second, format, 's', 'ss');
  format = _comformat(file.millisecond, format, 'S', 'SSS');
  return format;
}