dart timestamp
void main() {
print(new DateTime.now().millisecondsSinceEpoch);
}
dart timestamp
void main() {
print(new DateTime.now().millisecondsSinceEpoch);
}
flutter date time to timestamp
DateTime currentPhoneDate = DateTime.now(); //DateTime
Timestamp myTimeStamp = Timestamp.fromDate(currentPhoneDate); //To TimeStamp
DateTime myDateTime = myTimeStamp.toDate(); // TimeStamp to DateTime
print("current phone data is: $currentPhoneDate");
print("current phone data is: $myDateTime");
how to convert timestamp to datetime in dart
Timestamp time; //from firebase
DateTime.fromMicrosecondsSinceEpoch(time.microsecondsSinceEpoch)
convert timestamp to millisecond in dart
void main() {
String test = "10:12:23.24";
String hr = test.split(":")[0];
// print(hr);
String minutes = test.split(":")[1];
// print(minutes);
String seconds = test.split(":")[2].split(".")[0];
// print(seconds);
String milliseconds = test.split(":")[2].split(".")[1];
// print(milliseconds);
Duration duration = Duration(
hours: int.tryParse(hr) ?? 0,
minutes: int.tryParse(minutes) ?? 0,
seconds: int.tryParse(seconds) ?? 0,
milliseconds: int.tryParse(milliseconds) ?? 0);
print(duration.inMilliseconds);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us