as you seen in the title i want to convert from DateTime to unix Timestamp in Flutter (Dart Lang).
i saw the static Method that can convert from unix timestamp to DateTime :
DateTime.fromMillisecondsSinceEpoch(unixstamp);
i need the reverse
datatime => unixstamp
Thanks in advance.
DateTime time = DateTime. now(); time. millisecondsSinceEpoch; January 1st, 1970 at 00:00:00 UTC is referred to as the Unix epoch.
Darts DateTime
has a property millisecondsSinceEpoch
which should be what unix timestamp is as well.
DateTime.now().toUtc().millisecondsSinceEpoch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With