Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   I had an string of date where user inputs the date in his format covert it to my own (https://www.askmehelpdesk.com/showthread.php?t=820919)

  • Jan 24, 2016, 11:08 PM
    janapalasunil
    I had an string of date where user inputs the date in his format covert it to my own
    String date array has dates where user enters it and I don't know the format but I want to covert that into dd MMM yyyy format. Is it possible help me with the code.
  • Jan 25, 2016, 08:52 AM
    CravenMorhead
    Without knowing the input format, it will be REALLY hard unless you have rules. For example if your rules are:
    1) Year is ALWAYS 4 numbers
    2) Month is ALWAYS 3 letter abbrevation.
    3). Day is ALWAYS 2 letters

    Then yes, you just need to tokenize the input and use a switch or if tree based on the string length of each token.

    If the input has NO rules... Good luck. What day is 2/10/2015 ? Feb or Oct?

  • All times are GMT -7. The time now is 03:11 AM.