PDA

View Full Version : I had an string of date where user inputs the date in his format covert it to my own


janapalasunil
Jan 24, 2016, 11:08 PM
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.

CravenMorhead
Jan 25, 2016, 08:52 AM
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?