How can I get millisecondsSinceEpoch until today but not until now, only millisecondsSinceEpoch time until today at 00.00 o'clock.
Example when using DateTime.now() I get 2021-09-20 20:18:04, but what I want is I want to be able to get time 2021-09-20 00:00:00 for me to convert to millisecondsSinceEpoch
CodePudding user response:
Try this code
DateTime now = DateTime.now();
DateTime today = DateTime(now.year, now.month, now.day);
print(today.toString() "::" today.millisecondsSinceEpoch.toString());
results
2021-10-07 00:00:00.000::1633539600000