Julien
Julien

Reputation: 2756

Freemarker get current timestamp

How can I get the current timestamp (number of seconds since 01/01/1970) in a freemarker file? I know the .now var but I didn't figure how to get a basic timestamp format.

Upvotes: 4

Views: 10090

Answers (1)

Bohemian
Bohemian

Reputation: 425053

Use the ?long operator:

.now?long

for milliseconds, or

${.now?long / 1000}

for seconds

Upvotes: 5

Related Questions