Grails日期格式英文版 [英] grails date format in English language

查看:128
本文介绍了Grails日期格式英文版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  def currentDate = new Date()。format('E, dd MMM yyyy')

格式符合我的预期,但是它是用我的语言编写的电脑。
如何获得英文日期?
有帮助吗?谢谢!

解决方案

如果您在Controller中运行,我建议您使用

  def currentDate = new Date()

def formattedDate = g.formatDate(date:currentDate,format:'E,dd MMM yyyy ')


I have the following code to format the date:

def currentDate = new Date().format('E, dd MMM yyyy')

The format is as I expected, however it is written in the language of my computer. How can I get it to give the date in English? Any help? Thanks!

解决方案

If you're running in context of a Controller I would suggest you use

def currentDate = new Date()

def formattedDate = g.formatDate(date:currentDate, format: 'E, dd MMM yyyy')

这篇关于Grails日期格式英文版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆