Groovy date format for UTC with milliseconds

前端 未结 3 989
后悔当初
后悔当初 2021-01-07 17:35

I\'m having trouble finding a good way of formatting a UTC-time stamp with this format: yyyyMMdd-HH:mm:ss.

I wasn\'t able

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-07 18:07

    I would convert it like that:

    def now = new Date()
    println now.format("YYYYMMdd-HH:mm:ss") 
    

提交回复
热议问题