jQuery strftime plugin

A very terse post to accompany my first foray into jQuery plugin authoring. Apologies for the lack of decent documentation of use but I should get my slightly antiquated version of WordPress upgraded soon so I can put HTML listings up.

I was prompted to write this after a co-worker asked for a way to have the correct date included in web pages. This led into a long discussion along the lines of if the site is being delivered via JSP/ASP then we can have the date generated at the server side.

The only way this code would be of any use is if its being used on a completely static site – are there many of those left? And here’s the accessibility bit. If your user has JavaScript disabled for any reason they will not see the date.
Currently supports the following specifiers: %a %A %b %B %d %H %y %Y %m %M
if no formatting is given then it will default to ‘%d/%m/%Y’

$(’#span’).strftime()

The contents of the specified element will be set to the resultant formatted date string.

Code: jquery.strftime.js

Leave a Reply

You must be logged in to post a comment.