June 23, 200421 yr I imported a dbase file that has the date (year,month,day) 20021125 and I want to change it to (month,day,year) 11/25/2002. Can anyone help?
June 23, 200421 yr Well, I know this isn't the PHP forum, but I just did this yesterday using PHP so it's still fresh in my mind if you happen to know PHP and want to reformat the data before importing it into FileMaker. Here's my code for reformatting a field called $whenmodified... you'll have to loop it in an array or something to convert all your records and you won't need the time portion. $year = substr ($whenmodified, 0, 4); $month = substr ($whenmodified, 4, 2); $day = substr ($whenmodified, 6, 2); $hour = substr ($whenmodified, 8, 2); $min = substr ($whenmodified, 10, 2); $sec = substr ($whenmodified, 12, 2); $whenmodified_epochtime = mktime($hour, $min, $sec, $month, $day, $year); $whenmodified_date = date ("m/d/Y", $whenmodified_epochtime); $whenmodified_time = date ("g:i:s a", $whenmodified_epochtime); NERDY NOTES: I was actually converting a MySQL timestamp (date and time jammed together with no delimiters in a yyyymmddhhmmss format). I split the string into 2 parts into more FM-like modification date and modification time fields using PHP's date() function, but date() only works on datetimes stored as a single integer referred to as UNIX EPOCH TIME. I could have manually concatenated the fields once I had them split, e.g. $whenmodified_date = $month . "/" . $day . "/" . $year; and I originally did so, but the date() function allows greater flexibility for formatting for both dates and times so I used it instead. --ST
June 23, 200421 yr Author Thanks by creating a new Calculation field named "right date" that looks like this is the field when the wrong date field is called "wrong": Date(Middle(wrong,5,2),Right(wrong,2),Left(wrong,4)) and then make the out put a Date type. It works. If you make a copy of the main file and then make this new Calc. field. Then do the import into the copy file so that the date changes, then import this info to the original file but change the routing from the calc. field to the main file date field. easy. thanks.
Create an account or sign in to comment