Opened 14 years ago
Closed 13 years ago
#3502 closed enhancement (fixed)
Add a timestamp macro to templating module
Reported by: | mraross | Owned by: | jmckenna |
---|---|---|---|
Priority: | normal | Milestone: | 6.0 release |
Component: | Documentation - MapServer | Version: | unspecified |
Severity: | normal | Keywords: | timestamp |
Cc: | havatv |
Description
Need to output the date and time that a query result was created
Attachments (2)
Change History (9)
comment:1 by , 14 years ago
comment:3 by , 14 years ago
Is there any reason to not just support strftime output format strings and just pass them directly through from a "format=" parameter to strftime()? eg.
[date format="%Y/%m/%d:%H:%M:%S"]
With some reasonable standard format as a default.
Also to support local vs GMT, a parameter like "tz=(local|gmt)"?
by , 14 years ago
Attachment: | date_tag_chodgson.patch added |
---|
changes to support a configurable [date] tag
comment:4 by , 14 years ago
Attached is a patch implementing the [date] tag with support for the format and tz parameters.
The format string is simply passed-thru to strftime and so supports a myriad of output options (man 3 strftime for the complete listing). I've set the default output format to: "%d/%b/%Y:%H:%M:%S %z" which looks like: 01/Dec/2010:17:34:58 -0800
Which is the date format used by Apache's Common Log Format. It's defined in maptemplate.h and so is easy to change if someone suggests a better default.
When the tz parameter is set to "gmt", the output date will be Greenwich time, any other value (including the default) will output the local time. Also, the strftime format options support %z and/or %Z which allow the timezone offset or name to be output which may be of similar use.
comment:5 by , 13 years ago
Component: | Output-KML → MapServer Documentation |
---|---|
Owner: | changed from | to
Applied in r10902. Need to get this documented so I'm transferring ownership to the documentation component.
Steve
comment:6 by , 13 years ago
A patch for the templating documentation for the [date] tag is attached.
comment:7 by , 13 years ago
Cc: | added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed for 6.0 and trunk documentation in r12583.
We could have something that output the date and time using a [date] tag. It can output the current date and time using a static format the we fix here (something like Y-m-dTh:m:s). This could work like the [id] tag http://mapserver.org/mapfile/template.html Is there a need to have a flexible format to output this? Is there a need to differentiate between local time and Greenwich time?