当前位置:网站首页>BeanShell script gets the current time
BeanShell script gets the current time
2022-07-19 02:29:00 【[email protected]】
obtain 10 A time stamp :${__time(,)} 1、__time: Get the timestamp 、 Format time (1)、${__time(yyyy-MM-dd HH:mm:ss:SSS,time)} : Format to generate time format 2022-05-16 11:56:23:635 (2)、${__time(,)}: By default, the formula is accurate to the millisecond level , 13 digit 182794855253 (3)、${__time(/1000,)}: The formula is accurate to the second level , 10 digit 1827835371 (4)、${__time(yyyy-MM-dd,)}: The format generation time of this formula is :2022-04-16 (5)、${__time(yyMMdd,)}: The format generation time of this formula is :161036 Get script of current time :
import java.util.*; import java.text.SimpleDateFormat; String str1 = (new SimpleDateFormat("yyyy-MM-dd hh:mm:ss")).format(new Date()); vars.put("sta",str1);
an
You can reference sta To get the current time
The current date plus 1 Script for
import java.util.*;
import java.text.SimpleDateFormat;
String str1 = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date()); // The current date
String str2 = (new SimpleDateFormat("yyyy-MM-dd")).format(DateUtil.getDayAfter(new Date())); // The current date +1
String str3 = (new SimpleDateFormat("hh:mm:ss")).format(new Date());
String str4 = DateUtil.getDateFormat(DateUtil.getDateFormat("2017-11-21")); // Specify Date
String str5 = (new SimpleDateFormat("yyyy-MM-dd")).format(DateUtil.getDayAfter(DateUtil.getDateFormat("2017-11-21"))); // The current date +1
vars.put("sta",str1);
vars.put("sta1",str2);
vars.put("sta2",str4);
vars.put("sta3",str5);
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
Date date =new Date(); // Get the current time
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowDate = sf.format(date);
vars.put("startTime",nowDate);
//System.out.println(nowDate);
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR,+5); // current time +5 God
String senderDate = sf.format(cal.getTime());
vars.put("endTime",senderDate);
// Time stamp : Shift the current time backward 3 God
// var now_date = new Date().getTime()/1000;
var now_date = new Date().getTime()/1000+259200;
vars.put("now_date",now_date.toString());
// Time stamp : Current timestamp 10 position
var now_date = new Date().getTime()/1000;
vars.put("timestamp",now_date.toString());
// Time stamp : Current timestamp 13 position
var now_date = new Date().getTime();
vars.put("timestamp1",now_date.toString());
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207170009049606.html
边栏推荐
猜你喜欢
Logic vulnerability - login verification code security
flask模板注入
Signal and system experiment
innodb、Mysql结构、三种删除的区别
攻防世界----shrine
Gdb+vscode for debugging 1 -- compile and debug using cmakelist files + attach process debugging
VLAN和TRUNK口配置
Chapter 2 - system control principle - > classical control theory
Jmeter接口测试之响应断言
STL--stack容器
随机推荐
[unity Editor Extension] the pre-processing and post-processing pictures of unity assets are automatically transferred to sprite2d
[antv G2] how to add a click event to the line chart (click anywhere to get the value of the point on the line)
【工具篇】Unity快速上手制作2D和2.5D游戏的神器TileMap
最短路/次短路/K短路
逻辑漏洞---登录验证码安全
Install websocketpp
Logical vulnerability - authentication vulnerability
【Unity开发小技巧】Unity混音器Mixer控制全局音量
《Visual C#从入门到精通》个人学习整理
Cocoon breaking and rebirth of 3D NFT: caduceus decentralized edge rendering technology
Lecture 2 BTC cryptography principles (notes)
ctfhub--ssrf
innodb、Mysql结构、三种删除的区别
初识阿里云环境搭建:无法远程连接,入过的坑:服务器ping不通,FTP搭建,服务器搭建数据库,远程连接服务器数据库
[antv G2] how to solve the memory leak caused by G2
剑指 Offer 48. 最长不含重复字符的子字符串
[tools] unity2d character controller, which controls 2D players to move and jump in four directions and horizontal directions
How to configure multiple SSH keys for novices (easy to understand hand-in-hand teaching)
GoReplay
Attack and defense world - easytornado notes