nightdesigns Posted March 9, 2007 Posted March 9, 2007 I need to parse a date from a field. Unfortunately, the way it's entered is not consistent. It's always in MDY format, but somtimes it's M/DD/YY or MM/D/YYYY or MM-DD-YY, etc. What would be the best way to parse all of this data? This is on FM5 Thanks
Lee Smith Posted March 9, 2007 Posted March 9, 2007 Try this modified calcalulation that was shared by Bob Weaver. Let([ Parts=Substitute( YourDateField; ["/";" "]; ["-" ; " "]); Month=LeftWords(Parts;1); Day=MiddleWords(Parts;2;1); Year=RightWords(Parts;1)]; Day &"/"& Month &"/"& Year) HTH Lee
Raybaudi Posted March 9, 2007 Posted March 9, 2007 Hi ... but those dates are all inside the same date field ? or is that field a text field ?
LaRetta Posted March 9, 2007 Posted March 9, 2007 (edited) No Let[] within vs. 5 ... drat! We are so spoiled with 7/8/8.5! Edited March 9, 2007 by Guest
Raybaudi Posted March 9, 2007 Posted March 9, 2007 This is the same calc of Lee, but for v. 5 Date ( LeftWords ( Substitute ( Substitute ( YourField , "/" , " " ) , "-" , " " ) , 1 ) , MiddleWords ( Substitute ( Substitute ( YourField , "/" , " " ) , "-" , " " ) , 2 , 1 ) , If( Length( RightWords ( Substitute ( Substitute ( YourField , "/" , " " ) , "-" , " " ) , 1 ) ) = 2 , "20" & RightWords ( Substitute ( Substitute ( YourField , "/" , " " ) , "-" , " " ) , 1 ) , RightWords ( Substitute ( Substitute ( YourField , "/" , " " ) , "-" , " " ) , 1 ) ) )
Recommended Posts
This topic is 6471 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now