kgetWeekday method

String kgetWeekday({
  1. bool isChina = true,
})

获取dateTime是星期几 支持中英文

Implementation

String kgetWeekday({bool isChina = true}) {
  var file = this;
  String weekday = "";
  switch (file.weekday) {
    case 1:
      weekday = isChina ? '星期一' : 'Monday';
      break;
    case 2:
      weekday = isChina ? '星期二' : 'Tuesday';
      break;
    case 3:
      weekday = isChina ? '星期三' : 'Wednesday';
      break;
    case 4:
      weekday = isChina ? '星期四' : 'Thursday';
      break;
    case 5:
      weekday = isChina ? '星期五' : 'Friday';
      break;
    case 6:
      weekday = isChina ? '星期六' : 'Saturday';
      break;
    case 7:
      weekday = isChina ? '星期日' : 'Sunday';
      break;
    default:
      break;
  }
  return weekday;
}