timestampToTime function

DateTime timestampToTime(
  1. int? timestamp, {
  2. TimeLength timeLength = TimeLength.ten,
})

时间戳转时间

Implementation

DateTime timestampToTime(int? timestamp, {TimeLength timeLength = TimeLength.ten}) {
  if (timestamp == null) {
    return DateTime.now();
  }
  int a = 0;
  if (timeLength == TimeLength.ten) {
    a = timestamp * 1000;
  } else {
    a = timestamp;
  }
  return DateTime.fromMillisecondsSinceEpoch(a);
}