stamp method

String stamp([
  1. DateTime? at
])

The current time as an RFC 3339 timestamp with milliseconds and Z.

Implementation

String stamp([DateTime? at]) {
  final t = (at ?? now()).toUtc();
  String two(int v) => v.toString().padLeft(2, '0');
  return '${t.year.toString().padLeft(4, '0')}-${two(t.month)}-${two(t.day)}'
      'T${two(t.hour)}:${two(t.minute)}:${two(t.second)}'
      '.${t.millisecond.toString().padLeft(3, '0')}Z';
}