Working with DatesHome Contents Please email any bug reports, comments or suggestions to ExperLog's Online Support OverviewIn most cases, ExperShop uses long integers to store date/time informations: the main reason is that every database has its own Date formats, but every database can store long integers!This way of handling dates is y2k compliant, of course, as ExperShop has been designed in 1999 (with current integer formats, a problem might occur in year... 2037, but in 2037 Integers should be wider than today ;)
Displaying dates in DynHtml templatesDynHtml includes a predefined data object, called "CurrentDate", that gives access to dates relative to the currend day.For example, $CurrentDate:Now$ is the current day. CurrentDate has the following attributes:
Formats are those defined in the java.text.DateFormat class, so you can also use the predefined DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG and DateFormat.FULL formats; Example, $(DateFormat.SHORT)CurrentDate:Now$ will display the current date in short format. Dates can also be shifted, relative to the current time; for example, the following constructs are valid:
Converting text to date valuesThe (DateVal) modifier can be used to convert a date text to an ExperShop date value (a long integer); the date text must be of the following format: yyyy:MM:dd (yyyy is the year, MM the month and dd the day).
For example, if the "dt" variable is defined as such:
Date formatsA date can be formatted for display using the Dateformat format. For example, the current date can be displayed in yyyy/mm/dd format as follows (eg. 2001/10/25 representing October 25th, 2001):$Defvar today $CurrentDate:Now$ $(DateFormat.yyyy/MM/dd)today$The format that follows "DateFormat." corresponds to the format supported by the java.text.SimpleDateFormat java class (Java 2 SDK): the description below is an excerpt from Sun's documentation concerning the java.text.SimpleDateFormat class, and is applicable to ExperShop's date formats. (----- Sun documentation excerpt starts here -----) Format Syntax: To specify the time format use a time pattern string. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following: The count of pattern letters determine the format.Symbol Meaning Presentation Example ------ ------- ------------ ------- G era designator (Text) AD y year (Number) 1996 M month in year (Text & Number) July & 07 d day in month (Number) 10 h hour in am/pm (1~12) (Number) 12 H hour in day (0~23) (Number) 0 m minute in hour (Number) 30 s second in minute (Number) 55 S millisecond (Number) 978 E day in week (Text) Tuesday D day in year (Number) 189 F day of week in month (Number) 2 (2nd Wed in July) w week in year (Number) 27 W week in month (Number) 2 a am/pm marker (Text) PM k hour in day (1~24) (Number) 24 K hour in am/pm (0~11) (Number) 0 z time zone (Text) Pacific Standard Time ' escape for text (Delimiter) '' single quote (Literal) '
(Text): 4 or more pattern letters--use full form, < 4--use short or abbreviated form if one exists. (Number): the minimum number of digits. Shorter numbers are zero-padded to this amount. Year is handled specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits. (Text & Number): 3 or over, use text, otherwise use number. Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes. (------ Sun documentation excerpt ends here ------)
|