![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 String date="${__javaScript((new Date()).getFullYear()+'-'+((new Date()).getMonth()+1)+'-'+(new Date()).getDate(),)}"; 2 log.info("获取当前日期:"+date); 3 String date1="${__javaScript((new Date()).getFullYear()+'-'+((new Date()).getMonth()+1)+'-'+(new Date()).getDate(),storageTheDate)}"; 4 String date2="${storageTheDate}"; 5 log.info("获取存储在变量中的日期:"+date2); 6 String year="${__javaScript((new Date()).getFullYear(),)}"; 7 log.info("获取年:"+year); 8 String month="${__javaScript(((new Date()).getMonth()+1),)}"; 9 log.info("获取月:"+month); 10 String day="${__javaScript((new Date()).getDate(),)}"; 11 log.info("获取日:"+day);