@LocaleDateTime()
New in 2.0Generate localized current datetime
Date and TimeSince 2.0.0
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| format | — | — | Datetime format pattern, default "yyyy-MM-dd HH:mm:ss" | |
| zoneId | — | — | Timezone ID, default "Asia/Shanghai" | |
| random | — | — | Generate random datetime ±10 years, default false |
Usage
@LocaleDateTime(arg0,arg1,arg2)Generate random datetime with specified format and timezone
Example:
@LocaleDateTime(yyyy-MM-dd HH:mm:ss,Asia/Shanghai)
Output:
2022-01-01 23:34:252022-01-01 23:34:25@LocaleDateTime(arg0,arg1)Generate random datetime with specified format
Example:
@LocaleDateTime(yy-MM-dd a HH:mm:ss)
Output:
22-05-12 下午 23:40:2222-05-12 下午 23:40:22@LocaleDateTime(arg0)Generate current datetime with specified format
Example:
@LocaleDateTime(yy-MM-dd a HH:mm:ss)
Output:
22-05-12 下午 23:40:2222-05-12 下午 23:40:22@LocaleDateTime()Generate current datetime (yyyy-MM-dd HH:mm:ss, Asia/Shanghai)
Example:
@LocaleDateTime()
Output:
2022-01-01 23:34:252022-01-01 23:34:25