OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

office-formula message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Proposal: DateParameter, TimeParameter

I propose adding two new pseudo-types, DateParameter and TimeParameter.
Let me explain..

Many spreadsheets, inc. Excel, OpenOffice.org/StarOffice, and Gnumeric
accept either number OR text (string) for many date/time functions.
E.G., MONTH returns the month number of a date, accepting either
text or string.  For apps that do automatic conversion of text to number,
that's unsurprising, but even OOo does it (and OOo does not do auto-conversion).
This shows that the semantics for OOo at least is not simply
"accept a number", and I think OOo does a good thing in these cases.

I think this would be better captured by changing the parameter type
for such functions so that they accept the pseudo-type
DateParameter or TimeParameter instead.  There would then be
conversion operators for them; DateParameter would look like this:
* If number, return number.
* If text, call DATEVALUE; if it returns a value, return that value.
   If it returns an Error, it returns Error or the result of applying VALUE.
* Logical, imp-defined (Logical or Error or Number)
* Reference, convert to Scalar then apply as above

DATEVALUE must support ISO date formats, so there'll be at least
one text format that is always interpreted the same way internationally
(note that this is different from the general text->number problem).

Then MONTH("2006-11-22") = MONTH(DATE(2006;11;22)).

--- David A. Wheeler 

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]