Main Stories
Slash Boxes

Slash Open Source Project

Slashcode Log In

Log In

[ Create a new account ]

Article Poll

Poll I found this article to be
Very Helpful
Not Helpful
Not Very Helpful
[ Results | Polls ]
Comments:0 | Votes:1

Getting mtime of a file with timeCalc()

posted by Krow on 01:01 PM March 16th, 2002   Printer-friendly   Email story
I'm trying to display the mtime of a file like this:

[% USE File('/path/to/image.jpg') %]
[% File.mtime %]
[% Slash.timeCalc(File.mtime) %]

The [% File.mtime %] displays a correct mtime value like 1015776901, but the following line displays "Wednesday December 31, @07:00PM " (with user's date/time format preference set to EST). Is there another/better/right way to do this?
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login
Loading... please wait.
  • Did you do the 'use slash' at the top of the template?

    What's the user's *preference* set to for timezone? Is it EST? If not, what's it set to?
    lottadot []
    • Yes, the template has 'use slash', and the user's preference is set to EST. I think the problem is that timeCalc() expects a MySQL date, not a unix date. I ended up just using the template toolkit date function, which works fine.