April 25, 200520 yr Hi, I have no idea where to put this post, so I'll put it here... Does anyone know how to differentiate between English US and English UK date formatting, in a script or field calculation . Get( SystemLanguage ) just returns "English". Also, you don't appear to be able to set a field to (say) GetAsDate( "31/01/2005" ) and then retrieve it as "?" - the script interpreter always interprets it as 31st January. Any ideas ? Thanks, Roger.
April 25, 200520 yr Filemaker uses system date formatting for display, to interpret data entry, and in the GetAsDate (text) and GetAsText (date) functions. System date formatting can be set independently of the language, so Get(SystemLanguage) cannot be relied upon to determine the current system date format. If your system is set to use the d/m/y format, GetAsDate ( "31/01/2005" ) is a valid date entry. If you change your system to m/d/y, AND set the file to use current system settings, it will become invalid and return "?". I tend to not rely on date formatting for anything critical, and use date functions instead to point at month and day explicitly. You could determine the current system date format by examining the interpretation of a known date, although it will take some work. For example: Let ( test = GetAsText ( Date ( 1 ; 2 ; 3456 ) ) ; Case ( Left ( test ; 1 ) = 0 ; // there is a leading zero for the first parameter Left ( test ; 1 ) = 1 ; // the first parameter is month with no leading zero Left ( test ; 1 ) = 2 ; // the first parameter is day with no leading zero etc. You can continue this to determine the rest of the formatting, incl. the separator and year's length.
April 27, 200520 yr Author I thought a trivial mod to my date fields would be to have a default value (when the record is created) of "mm/dd/yyyy" (or "dd/mm/yyyy"). Turns out not to be trivial at all. I tried using: Left( GetAsText( Date( 1; 11; 2001 ) ) ) but it ALWAYS returns "11" in the first two characters irrespective of the current system format (presumably coz the file was created on a UK setting). However, all the date fields show the date correctly when I switch system formats (they show up as either mm/dd or dd/mm). Regards, Baffled and Frustrated.
April 27, 200520 yr I'm afraid I don't quite follow. Do you still have a problem that needs a solution?
Create an account or sign in to comment