getDateString method

String getDateString(
  1. DateTime now
)

Implementation

String getDateString(DateTime now) {
  return now
      .toUtc()
      .toIso8601String()
      .replaceAll(RegExp(r'.\d{6}Z$'), 'Z') // 移除多出的毫秒
      .replaceAll(RegExp(r'.\d{3}Z$'), 'Z'); // 移除为 0 时多出的毫秒
}