Skip to content

Datetime Parse issue  #51118

Closed
Closed

Description

@Sachinsowri

In Flutter didn't parse the String like Format DD/MM/YYYY

DateTime.parse("20/02/2020") it throws Invalid date format ...

how to parse this formate type string into DateTime....

Activity

  1. rubgithub commented on Feb 20, 2020

    @rubgithub

    In Flutter didn't parse the String like Format DD/MM/YYYY

    DateTime.parse("20/02/2020") it throws Invalid date format ...

    how to parse this formate type string into DateTime....

    https://stackoverflow.com/questions/58329577/how-to-check-whether-the-entered-date-in-textfield-is-valid-or-not-in-dart-flutt

  2. VladyslavBondarenko commented on Feb 20, 2020

    @VladyslavBondarenko

    @Sachinsowri
    You can do it for example with help of intl package

    DateFormat inputFormat = DateFormat("dd/MM/yyyy");
    DateTime dateTime = inputFormat.parse("20/02/2020");
    

    Please see https://flutter.dev/community for resources and asking questions like this,
    you may also get some help on Stack Overflow.
    Closing, as this isn't an issue with Flutter,
    if you disagree please write in the comments and I will reopen it
    Thank you

  3. Sachinsowri commented on Feb 20, 2020

    @Sachinsowri
    Author

    https://stackoverflow.com/questions/57545452/dart-convert-time-from-dd-mm-yyyy-to-yyyy-mm-dd

    DateFormat inputFormat = DateFormat("dd/MM/yyyy");
    DateTime dateTime = inputFormat.parse("18/08/2019");
    

    thanks but why should use format like this .

    YYYY-MM-DD didnt need any formate ... but YYYY/MM/DD or DD/MM/YYYY this type of string parse throw a invaild date formate

  4. VladyslavBondarenko commented on Feb 20, 2020

    @VladyslavBondarenko

    @Sachinsowri
    DateTime.parse has limited list of accepted strings

    https://api.flutter.dev/flutter/dart-core/DateTime/parse.html

  5. github-actions commented on Aug 22, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions