Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Groovy 脚本的新手,我想知道如何将我从 SQL 数据库获得的值转换为 XML 值?
例如:
我有一个变量 start_date 包含 '2013-04-13 14:34:08'
我想将其转换为:
'2013-04-13T14:34:08'
任何帮助将非常感激!
从一个字符串:
def start_date = '2013-04-13 14:34:08' println start_date.replace(' ', 'T')
从日期开始:
def start_date = new Date() println start_date.format('yyyy-MM-ddTHH:mm:ss')