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)

date_tag_chodgson.patch (3.4 KB ) - added by chodgson 13 years ago.
changes to support a configurable [date] tag
date_doc.patch (1.3 KB ) - added by chodgson 13 years ago.
doc patch for the [date] tag

Download all attachments as: .zip

Change History (9)

comment:1 by assefa, 13 years ago

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?

comment:2 by mraross, 13 years ago

We only need local time but others may need Greenwich.

comment:3 by chodgson, 13 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 chodgson, 13 years ago

Attachment: date_tag_chodgson.patch added

changes to support a configurable [date] tag

comment:4 by chodgson, 13 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 sdlime, 13 years ago

Component: Output-KMLMapServer Documentation
Owner: changed from assefa to jmckenna

Applied in r10902. Need to get this documented so I'm transferring ownership to the documentation component.

Steve

comment:6 by chodgson, 13 years ago

A patch for the templating documentation for the [date] tag is attached.

by chodgson, 13 years ago

Attachment: date_doc.patch added

doc patch for the [date] tag

comment:7 by havatv, 13 years ago

Cc: havatv added
Resolution: fixed
Status: newclosed

Fixed for 6.0 and trunk documentation in r12583.

Note: See TracTickets for help on using tickets.