php - Convert custom date format using a simple user-entered format -
i need import text files various sources contain dates in various formats. given how many messed pieces of data have encountered in test files have gathered far, have decided force user enter date format before importing file, e.g. mmddyyyy
or dd.mm.yyyy
etc.
i can't expect these users understand enough enter y-m-d
or n/j/y
formats easy enough parse, , can't rely on "standards" "if dash used, month comes before day", etc., automatic parsing out of question.
the other issue usual php date formatting can't predict if date format have single or double digits, , don't know how createfromformat
parse if give them single digit when expects double digit...
so first thought start separating pure numeric dates others , force user enter full 8 digit date along format code - otherwise becomes messy. that's far i've gotten far...
i thought parsing date , format string side side, again cause issues one-digit numbers if i'm not careful.
i haven't found that'll in case, maybe i'm taking wrong angle - maybe there's javascript or jquery date format selection tool out there that's compatible php date formats...
any suggestions on best approach this?
jquery ui has datepicker, have used in several apps ensure format of dates same
Comments
Post a Comment