To format a datetime, use StrFTime. For example to output the date in the following format “11/16/2006 11:58PM”, do the following: nowDT.strftime(“%m/%d/%y %I:%M%p”). nowDT is your datetime variable.
See the php documentation for further information. This also works for ruby on rails.