どうも、ちょげ(@chogetarou)です。
DateTimeの日付の秒を取得する方法を紹介します。
方法

DateTimeの日付の秒を取得するには、secondプロパティを使います。
具体的には、「dt.second」のように、DateTimeのsecondプロパティにアクセスします。
dt.second
DateTimeのsecondプロパティにアクセスすることで、日付の秒を取得することが出来ます。
使用例
void main() {
var dt = DateTime.parse('2022-01-01 00:00:00');
var dt2 = DateTime.parse('2022-04-01 00:00:30');
print(dt.month); //1
print(dt2.month); //4
}
コメント