15 lines
417 B
Dart
15 lines
417 B
Dart
// 获取当前年月字符串(格式:2025-07)
|
||
String getCurrentYearMonth() {
|
||
final now = DateTime.now();
|
||
return '${now.year}-${now.month.toString().padLeft(2, '0')}';
|
||
}
|
||
// 获取当前年份字符串
|
||
String getCurrentYear() {
|
||
return DateTime.now().year.toString();
|
||
}
|
||
|
||
// 获取当前月份字符串(带前导零)
|
||
String getCurrentMonth() {
|
||
return DateTime.now().month.toString().padLeft(2, '0');
|
||
}
|