microtuts

Spark ViewEngine: Format Date/time

I was using the Spark ViewEngine and needed to format a DateTime object coming from my model in the view. I thought there might be some kind of helper but it turns out you can just do this:

${String.Format("{0:dddd, MMMM d, yyyy}", Model.UpdatedAt)}

This particular example would give you a date formatted like so: Tuesday, April 17th, 2012.


Creating your first programming language is easier than you think.

Understanding how a programming language works is a surefire way to be a better developer. Read more.


Suggested Reading


written by Ryan Bosinger
Ryan is a web developer living and working in Banff Alberta. He also writes for giftsforpeoplewitheverything.com and freefoley.com.

Leave a Reply