SQLTerminal.app
now available

XPath.app
now available
Want fresh tech tips in your inbox?

Custom Date Formats for Your Rails Application

       

If you use a consistent date format often in your Rails applciation, it is worth it to add the format to your application environment. You can do this by adding  it to the bottom of the config/environment.rb file.


Time::DATE_FORMATS[:my_custom_format] = "%A %B %d, %Y"

Now you can use it in your views like this


@post.created_at.to_s(:my_custom_format)
Which will output something like Monday May 5, 2009

Tagged w/ #date #formatting #rails #ruby #timeruby on rails

Apps I've Built

XPath Expression Editor
Practice and improve your XPath skills with XPath Editor
Click to buy on the App Store
Photo Location Changer
Easily change the location on your photos and videos
Click here for more info about the app
Photo Date Changer
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app