AnsweredAssumed Answered

Passing dates as numbers

Question asked by davidhead Expert on Oct 7, 2008
Latest reply on Oct 10, 2008 by AndreasT


Passing dates as numbers


It has been suggested in the FileMaker Training Series materials that dates in FileMaker Pro are stored as numbers. However, international date issues suggest otherwise. In an effort to get consistent interpretation of dates between US formatted and International formatted systems, we have proposed passing dates (in parameters) as numbers.


So you can convert a date to a number using GetAsNumber ( datefield ).

If the date field contained 10/10/2008, this would return 733325. 

This number is recognised by FileMaker Pro as  733325 days since Jan 1, 0001.


So far so good.


When the number is received, it needs to be converted back to a date.


The online help says that the GetAsDate function requires text - any text expression or text field containing text in the same format as the date on the system where the file was created. 


When you use this - GetAsDate ( "733325" ) it returns a ? which would be expected.


However, both GetAsDate ( 733325 ) and GetAsDate ( GetAsNumber ( 733325 ) ) return a date.


So the question is - is the documentation wrong or incomplete? Is this behaviour supported? Can you really pass a number to the GetAsDate function and have it return the correct answer?


I suspect the same questions should be posed for the GetAsNumber function - it uses a text parameter which is "any text expression or text field containing numbers". So is it supported behaviour that you can pass a date to the function and have it return the number?