Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Changing Date from 20021125 to 11/25/2002

Featured Replies

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?

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

  • 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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.