Fleegix.org

JavaScript strftime

2005-10-26 22:38:00

We have to do a lot of date formatting in the Scooby UI, and after about the fifth time of writing a one-off function to format a date in a certain way, I realized what I really needed was a JavaScript implementation of the normal strftime function you find in the major scripting languages like Perl, PHP, and Ruby -- it's a truly indispensible tool for anyone who has to twist and manipulate dates into different formats for display.

Not wanting to reinvent the wheel of course, I looked around and found what looks like a nice implementation by Jonathan Buhacoff. Unfortunately, it's GPL-licensed, and all the Scooby code is released under the more permissive Apache License v. 2, so we can't use it.

So I've implemented a Javascript strftime for us to use with the Scooby project, and like all other Scooby code, it's Apache-licensed. You can download the latest stable version of the date.js file from OSAF's SVN server. I've also created some basic documentation on the OSAF Wiki.

I hope this thing can be useful for other folks besides just us. Please send me patches for fixes and improvements.

About

This is the blog for Matthew Eernisse. I currently work at Yammer as a developer, working mostly with JavaScript. All opinions expressed here are my own, not my employer's.

Related

Previous posts

All previous posts ยป

This blog is a GeddyJS application.