today.groovy
- import java.util.Date;
- import java.text.SimpleDateFormat;
- // 日期格式化
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
- Date date = new Date();
- String now = sdf.format(date);
- println now;
python 打印当前时间
- import datetime
-
- date = datetime.datetime.now()
- now = date.strftime('%Y-%m-%d %H:%M:%S')
- print(now)