Created
July 15, 2022 10:43
-
-
Save nbnD/44091498a1cd32e85a96d8abba5ec7dd to your computer and use it in GitHub Desktop.
Date picker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(pickedDate != null ){ | |
print(pickedDate); //get the picked date in the format => 2022-07-04 00:00:00.000 | |
String formattedDate = DateFormat('yyyy-MM-dd').format(pickedDate); // format date in required form here we use yyyy-MM-dd that means time is removed | |
print(formattedDate); //formatted date output using intl package => 2022-07-04 | |
//You can format date as per your need | |
setState(() { | |
dateController.text = formattedDate; //set foratted date to TextField value. | |
}); | |
}else{ | |
print("Date is not selected"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment