toLocalTime method

DateTime toLocalTime({
  1. bool isutc = false,
})

转成当地时间

Implementation

DateTime toLocalTime({bool isutc = false}) {
  if (this.isNullOrZero) {
    return DateTime.now();
  }
  int mstime = this ?? 0;
  if ("$this".length == 10) {
    mstime = this ?? 0 * 1000;
  }
  DateTime time = DateTime.fromMillisecondsSinceEpoch(mstime, isUtc: isutc).toLocal();
  return time;
}