Greg O'Connor Posted March 12, 2009 Posted March 12, 2009 Through a web form FileMaker receives a text like this: Friday, 6 March, 2009 How to convert this into a FileMaker compatible date field like this: 3/6/2009? I am stuck with it and don't know what to do. Is there an easy method or complicated calculation available? Any help would be great. Cheers Greg
comment Posted March 12, 2009 Posted March 12, 2009 Try something like: Date ( Ceiling ( Position ( "janfebmaraprmayjunjulaugsepoctnovdec" ; Left ( MiddleWords ( ImportedDate ; 3 ; 1 ) ; 3 ) ; 1 ; 1 ) / 3 ) ; MiddleWords ( ImportedDate ; 2 ; 1 ) ; MiddleWords ( ImportedDate ; 4 ; 1 ) )
Greg O'Connor Posted March 12, 2009 Author Posted March 12, 2009 (edited) Thanks, found a solution: http://www.briandunning.com/cf/852 Custom Function: GetTextAsDate (dateTxt; formatTxt) ... which I hopefully get to work! Cheers Edited March 12, 2009 by Guest
LaRetta Posted March 12, 2009 Posted March 12, 2009 Holy Mule! Why use a long convoluted custom function when a clean, simple, tiny calculation will do it?
Greg O'Connor Posted March 12, 2009 Author Posted March 12, 2009 If I only would be able to get the 'clean, simple, tiny calculation' get to work. Do you have a solution? Cheers Greg
comment Posted March 12, 2009 Posted March 12, 2009 Where specifically is the difficulty? ConvertDate.fp7.zip
Greg O'Connor Posted March 12, 2009 Author Posted March 12, 2009 Perfect now. It did not work because I changed the format of the imported date. Great sample, thanks a lot! Greg
LaRetta Posted March 12, 2009 Posted March 12, 2009 (edited) Well now, I liked that, Michael. I've used similar calcs to find the position of the short months but I've always used 1+Position(etc... ). But adding 1 is sloppy because it just changes 1.3333333333 to 2.3333333333 after divided by 3. Your method of using Ceiling precisely rounds up to 2; no trailing .333333's. It's a good reminder ... I don't think I take advantage of Ceiling() often enough. Edited March 12, 2009 by Guest
Recommended Posts
This topic is 5794 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