ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: How can I set last modified date in html files using ant?
Date Sat, 05 Feb 2005 20:53:30 GMT

This doesn't really seem like an Ant question at all.  I think you can 
achieve what you want by displaying the last modified date via 
javascript.  Let the browser figure out the date.

var lastmod = document.lastModified;    // get string of last modified date
var lastmoddate = Date.parse(lastmod);  // convert modified string to date
if(lastmoddate == 0) {                  // unknown date (or January 1, 1970 
GMT)
    document.writeln("Last Modified: Unknown");
} else {
   var d = new Date(lastmod);
   document.writeln("Last Modified: " + d.toLocaleString());
}

I would put that in a separate lastmod.js file and include it wherever in 
the page you want the date displayed....


<script src="lastmod.js" type="text/javascript"></script>


Jake

At 06:36 PM 2/5/2005 +0000, you wrote:
 >I want set the last modified date in html files from an ant script, so
 >that each file has a line reading, for example:
 >
 >"Last modified 04 February 2005" where the date is the date the file was
 >modified, not the date the ant script was run.
 >
 >I know I can achieve this using SSI with the following code:
 ><!--#config timefmt="%d  %B  %Y" -->
 >Last modified <!--#echo var="LAST_MODIFIED" -->
 >
 >However, this does not solve my problem since I want to distribute a
 >zipped documentation bundle containing the html files as well as
 >providing access to them over the web.
 >
 >I've search google and the mailing list archives but haven't been able
 >to find an answer.
 >
 >Any suggestions or pointers would be greatly appreciated.
 >
 >Luke Lindsay
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
 >For additional commands, e-mail: user-help@ant.apache.org
 >
 >  


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message