Re: Questions about date:parse-date(), date:format-date() and date:date-format
"A. Pagaltzis" <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <20060809223058.GM32689@klangraum> |
* 险峰 张 <[email protected]> [2006-08-09 09:35]: > When I read the specifications for date:format-date() and > date:parse-date(), I am a little confused. They look somewhat > redundant to me. If I implement the date:format-date(), it > seems to cover what date:parse-date() can do. I have no idea how you got that impression. The functions are complements. `format-date` takes a date and a format specification and returns a string describing the date formatted according to the specification. `parse-date` takes an arbitrary string and a format specification and returns the date that the string describes according to the format specification. One function does the opposite of the other. > For example: date:format-date("2005-06-03", "yyyy") is the same > as date:parse-date("2005-06-03", "yyyy"). Am I right? The result is the same, but that’s only because the format you picked, `yyyy`, produces strings that can be interpreted as a legal XSD type. If you picked a format that’s not, the functions would do the opposite of one another. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>