How to force US date formats in a non-US region


#1

I’m helping a friend in Central America to debug a simple age-calculation procedure but he’s using US dates and I’m using Australian-style dates (31 Oct instead of Oct 31). I’ve reset my Language and Region location to the US, my time zone to Central America and my date formats to US-style but my Pan6 calculations insist on using Australian-style date interpretation. How do I masquerade as an American for this purpose?


#2

I think you have to relaunch Panorama 6 to get it to recognize the new settings. Panorama X, on the other hand, will recognize the changed settings immediately.


#3

That’s not it - I rebooted the Mac each time I made a change.


#4

You certainly shouldn’t have to reboot. I have no further ideas. When you say “Pan6 calculations” what exactly do you mean? Really the only function that is affected by the settings is date(.


#5

If you have the date of birth as a date field in your database, shouldn’t the age() function work independently of your machine’s date format?


#6

No - the d/b has DoB as text so I have to use the date( function to insert it into the age( function. I stuck this code in front of everything else:

message "US age is: " + str(age(date("06-30-1937")))
if error
    message "Australian age is: " + str(age(date("30-06-1937")))
endif

The output is “Australian age is 79”, showing that my Mac is not using US dates.


#7

That’s all I’m using. Both

Age = pattern( (today()-date(NewDate))/365.25,"#,")

and

AgeNum = age(date(NewDate))

fail.


#8

If the date of birth is in a text field using the pattern “mm-dd-yyyy”, then you could split the field into separate day, month, and year fields, or you can use text funnels to rearrange the date according to Australian date format – without making any changes to system preference settings.


#9

Seems to me that the error case will only happen if what is in the Day part could not also be a legal month value (i.e. greater than 12). A date like “03-07-1937” is “legal” in either format (no error) but is not equivalent.


#10

True - and they all work that way. But my friend in Central America can’t get it to work so I need to test US-style dates to see why not. But it’s now OK - I sent the file to Tom Cooper who kindly tested it and it ran - so there’s something else wrong at Orlando’s end.