Antville Macros
Tuesday, 31. December 2002
date and time (and how to format them)

For most items of a weblog (images, files, stories, comments) and also the weblog itself Antville keeps track of the date and time it was created and when it was last modified. There are two basic macros, createtime and modifytime, that you can use for display.

The weblog itself in addition has a special macro called lastupdate that will contain the date and time whenever an item inside a weblog (or the weblog itself) was updated or a new one was created.

Now, here are a few examples:

<% story.createtime format="short" %>

This will give you the date and time when your weblog was created, using the default "short" formatting as you defined it in the preferences of your weblog. To use the long format simply use the option format="long"

To display the date and time when eg. an image was modifed place the following somewhere in a skin:

<% image.modifytime format="long" %>

And to display the date and time your weblog was last updated place this eg. in the main skin:

<% site.lastupdate format="EE, dd.MM.yyyy, HH:mm" %>

In this example we're using a custom formatting pattern, where each part of it will return the following:

  • EE the abbreviated day name (eg. "Mon")
  • dd the day of the month with a leading zero if necessary (to avoid that use a single 'd')
  • MM the month of the year, also using a leading zero. M will avoid the leading zero, MMM will give you the abbreviated month name, MMMM the full name of it.
  • yyyy the year displayed as four digits. yy will use just the last two digits.
  • HH means the hour of the day
  • mm means the minute of the hour

There are a lot more patterns you can use for formatting date and time, you can find a complete list in sun's java api documentation

The output of these macros will change according to the language you defined in the preferences of your weblog, with one exception: if you use site.lastupdate and there were no updates in your weblog so far, it will display the text no updates so far, all other macros won't display anything.

... Comment

Re: date and time (and how to format them)

According to the sun link you mentioned above, EEE is used to abbreviate the day of the week. Your post says EE is used to abbreviate the month name, although further on you mention that MMM is used to abbreviate the month name while MMMM is used for the full name. Is the sun documentation correct?
Does Antville use timezone defined in the sun documentation?

... Link

I also remember finding differing information on this from different sources, but why didn't you just try out which string gives which result? In the Antville source, there is EEEE and EE and that works for me (I'd say it's correct). About the M, my own notes say that M stands for one or two digits, MM stands for two digits, and MMM for either the full name or an abbreviation. I'd say that's probably correct and I forgot to also mention MMMM, which always gives the full name. I never needed the M though, but if you do, just try it out! In my notes, I also have NNN, which always should result in an abbreviation (maybe only one letter?).

... link

Update

I fixed the part regarding the "EE". Generally, I'd suppose to say the docs at java.sun.com are correct.

... link


... Comment

Is there any am, pm mark ?? Like 06:00p or 06:00pm.

... Link

for AM or PM, try letter 'a' after KK:mm

% now format="KK:mma' your city•your country 'EE,dd.MM.yyyy" %

... link


... Comment
timezone

as i am no good in the whole java/macro-stuff i am not capable to show different timezones on my page.

how do i show the time of e.g. berlin and sydney?

... Link

One timezone at a time

To set the timezone for your website login and click preferences. Click the timezone drop-down box and select your timezone. click save. Your site will make postings with the time for your chosen timezone.

... link


... Comment
actual modification time

site.lastupdate only gives out the time when the last story or comment was added. Is there a way to show the time/date of the last update of any kind (i.e. also layout changes, added images etc.)? thx

... Link


... Comment
Last update by <% username %>

Is there any way to display the last user instead of boring time and date?

... Link


... Comment

Online for 8322 days
Last modified: 2/20/20, 5:31 AM
Status
Youre not logged in ... Login
Menu
... Home
... Tags

Search
Calendar
November 2024
SunMonTueWedThuFriSat
12
3456789
10111213141516
17181920212223
24252627282930
January
Recent updates
Grundlegendes: Wie Macros entstehen Im
Zuge der Erneuerung der hier befindlichen Dokumentation soll dargestellt werden,...
by libralop (1/18/17, 2:21 PM)
If the link on the
starting page leads you to http://foo.blogger.de/topics/topic1/ and you want...
by kinomu (1/6/11, 3:43 AM)
how to make topicchooser redundant?
hello, i am new to antville and have a problem...
by cafereiche (1/5/11, 8:26 PM)
+ position and line distance
" itemsuffix="" %> how does ist function? every time when...
by miamicat (7/12/10, 5:23 PM)
with a little javascript like:
<div><% story.content part="lead" fallback="text" %> <script type="text/javascript"><!-- var lead =...
by dotnet (4/9/09, 3:00 PM)
There's another parameter which enables
to specify the blog whose imagelist you would like...
by giardino (1/4/09, 11:00 AM)
Is it possible to create
a link to the root-page of the system or...
by phoque (6/7/08, 12:34 PM)
Thanks a lot for the
quick response, kinomu. The good side: Now I have...
by molosovsky (1/16/08, 11:59 AM)
There is no technical solution
to this problem, but try to change (or insert)...
by kinomu (1/16/08, 10:22 AM)
Sorry if I’m too stupid
to wrap my brain around this problem: Is there...
by molosovsky (1/16/08, 9:48 AM)
Optional viewlink I am using
the lead for long stories. And wish to give the...
by byggvirofbarley (7/12/07, 10:49 PM)
Macros to use smileys in
comments? Hi! I added some smileys to my image gallery...
by stuepfnick (5/20/07, 2:30 PM)
Was suchen Sie denn
genau?
by ichichich (5/15/07, 4:06 PM)
Ähm, ich glaube das Fixen
muss nicht mehr sein Hallo, äh 2004 der letzte Inhalt....
by stsboard (3/9/07, 9:48 PM)
I found a solution
and modified it slightly for usage with Antville. Add to...
by ichichich (1/18/07, 1:07 PM)
story.age would be great to
have a macro that does the same for stories. I'd...
by imp13 (1/17/07, 10:40 PM)
is it somehow possible to
change the word "comments" itsself, that automatically results when...
by yetused (11/11/06, 9:55 AM)
Thanks a lot! Just
what I was looking for.
by mwegsche (11/10/06, 11:24 AM)
That is possible: http://macros.antville.org/stories/44385/
(Beware: An invalid format of the timestamp may corrupt the database...
by ichichich (11/10/06, 10:38 AM)
Edit date OK, thanks for
the feedback. This was just the answer I had already...
by mwegsche (11/10/06, 8:47 AM)
This is one of
the top requested features...
by ichichich (11/9/06, 5:02 PM)
limit stories I want to
limit the number of stories on the homepage of my...
by mwegsche (11/9/06, 4:58 PM)
To get the login form/skin
you must add to query: skins/edit?key=MemberMgr.login
by click (7/29/06, 1:33 AM)
Need Help! I need to
modify the "Login" form/skin that a visitor to my blog...
by aqss (6/18/06, 10:15 PM)
that more interesting part of
the question didn't get answered ;) how can we...
by schimmerschnecke (1/31/06, 1:02 AM)

RSS feed

Made with Antville
Helma Object Publisher