mrok
mrok

Reputation: 2710

How change joda--time default DateTime format in Grails

I am using Grails 2.0.3 (groovy 1.8.6) with joda-time:1.3.1 and joda-time-templates plugins. Everything works perfectly but I would like to change displayed format for date and time. How can I do that? Every domain is scaffolded so I do not have access to any view to render it manually.

My domain

import org.joda.time.*
import org.joda.time.contrib.hibernate.*

    class Game {

        Team host
        Team guest
        String location
        DateTime date


        static mapping = {
            date type: PersistentDateTimeTZ, {
                column name: "date_timestamp"
                column name: "date_zone"
            }
        }
    }

rendered date

Date 5/24/12 5:53 PM

I would like to get it as

Date 5 may 2012 17:53 PM 

Is there any way to translate name of month

Upvotes: 3

Views: 1873

Answers (1)

allthenutsandbolts
allthenutsandbolts

Reputation: 1523

define this in config.groovy

jodatime {  format.org.joda.time.DateTime = "dd MMM YYYY HH:mm a" }

and that should take care of it.

Upvotes: 2

Related Questions