Ticket #3502 (closed enhancement: fixed)

Opened 3 years ago

Last modified 20 months ago

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

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

Change History

Changed 3 years ago by assefa

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?

Changed 3 years ago by mraross

We only need local time but others may need Greenwich.

Changed 2 years ago by chodgson

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)"?

Changed 2 years ago by chodgson

changes to support a configurable [date] tag

Changed 2 years ago by chodgson

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.

Changed 2 years ago by sdlime

  • owner changed from assefa to jmckenna
  • component changed from Output-KML to MapServer Documentation

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

Steve

Changed 2 years ago by chodgson

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

Changed 2 years ago by chodgson

doc patch for the [date] tag

Changed 20 months ago by havatv

  • cc havatv added
  • status changed from new to closed
  • resolution set to fixed

Fixed for 6.0 and trunk documentation in r12583.

Note: See TracTickets for help on using tickets.