On Thu, 13 Apr 2000, Rick Reumann wrote:

> I'm trying to use file.lastModified() to get the last mod date of a file
> and then print on the screen as a string. The problem is it looks
> like lastModified() returns a long? Do I have to covert my long to a
> string and then use SimpleDateFormater to format it how I want or
> is there a way to go right from my long to the date format I want?

Date d=new Date(logFile.lastModified());

Alternately, I've got a taglib that allows you to do just this without
resorting to a scriptlet:

<file:lastModified
name="/insidectm/logs/coxdirect/2000/cdcor2000report.htm"
/>

(Assuming that /app/webdocroot is the application directory... you can
also specify absolute filenames, but that's not such a wise idea in my
opinion.)


The taglibrary (JSP 1.1 only, unfortunately) can be downloaded at
http://cupid.suninternet.com/~joeo/filetags-1.1-dev.jar - it also includes
<file:read />, and <file:size />, with more tags scheduled to be written
as I need them. (A roadmap is available at
http://cupid.suninternet.com/~joeo/roadmap.html)

-----------------------------------------------------------
Joseph B. Ottinger               [EMAIL PROTECTED]
http://cupid.suninternet.com/~joeo      HOMES.COM Developer

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to