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.

possible to choose date format display on the fly?

Featured Replies

I have a "purchase date" field on a layout. I know I can set the format to "as entered", "12/28/14", "Dec. 25, 2014" etc. But I would like to let the user choose the format, say from a pop-down list. I suppose I could stack a bunch of differently formatted fields on top of each other, and hide all but the one format the user chooses. But is there a simpler way?

Not sure if it's simpler, but you could use a calculation field (with result type set to Text) that would convert the given date to the selected format. If you intend to use the same format notation as Filemaker does, the calculation could be something along the lines of:

Substitute ( DateFormat ;
[ "Thursday" ; DayName ( Datefield ) ] ;
[ "Thu" ; Left ( DayName ( Datefield ) ; 3 ) ] ;
[ "25" ; Day( Datefield ) ] ;
[ "12" ; Month ( Datefield ) ] ;
[ "December" ; MonthName ( Datefield ) ] ;
[ "Dec" ; Left ( MonthName ( Datefield ) ; 3 ) ] ;
[ "20" ; Left ( Year ( Datefield ) ; 2 ) ] ;
[ "14" ; Right ( Year ( Datefield ) ; 2 ) ] 
)

(This needs more work to allow leading zeros for day and month.)

Do note that no matter which option you choose, the formatting affects the display only. Users still need to enter dates in the date format used by the file.

 

  • Author

I created a value list to choose some different display options and overlaid them with hide calculations, and it works OK. However, even though FM can display a date like Dec 14, 2020, you cannot enter it that way - must be digits with separators. (Interesting - FM doesn't care what separator you use between digits and will accept dots, slashes, $ character, whatever). So I guess it would be confusing to users to display a date like Dec. or December but not allow that as input - of course I could write some functions to parse a text field, but that's overkill for this solution. When the field is set to display "As entered", and you use the pop down calendar to enter it, it has the format 12/25/2020, which in my case is the same as "short system date". So I guess i will set it to display that, just to be consistent.

Thanks.

12 minutes ago, human said:

FM doesn't care what separator you use between digits and will accept dots, slashes, $ character, whatever

I believe that if you want to enter only the day and the month (or the month and the day, if your file is using a M/D/Y date format) and have Filemaker auto-complete the current year, you must separate them by either the separator used by the file's date format in use, or by a forward slash. Otherwise you can use any character as a separator except a letter, a colon or the plus sign.

Note also that the date format your file is using is not necessarily the same as your OS short date format - see:
https://help.claris.com/en/pro-help/content/different-system-formats.html?Highlight=use system format

 

 

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.