Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

DateUtil Embedded Objects

Updated on 2024-04-03 GMT+08:00

A DateUtil embedded object provides methods of formatting time and calculating time.

Methods

Table 1 Method description

Method

Description

Example

String format(Date date, String pattern)

Formats Date to character strings according to the specified pattern.

Convert the planned job scheduling time to the millisecond format.

#{DateUtil.format(Job.planTime,"yyyy-MM-dd HH:mm:ss:SSS")}

Subtracts one day from the planned job scheduling time and convert the time to the week format.

  • #{DateUtil.format(DateUtil.addDays(Job.planTime,-1),"yyyyw")}

    If Job.planTime is January 7, 2024, value 20241 is returned.

  • #{DateUtil.format(DateUtil.addDays(Job.planTime,-1),"yyyyww")}

    If Job.planTime is January 7, 2024, value 202401 is returned.

Date addMonths(Date date, int amount)

After the specified number of months is added to Date, the new Date object is returned. The amount can be a negative number.

Subtract one month from the planned job scheduling time and convert the time to the month format.

#{DateUtil.format(DateUtil.addMonths(Job.planTime,-1),"yyyy-MM")}

Date addDays(Date date, int amount)

After the specified number of days is added to Date, the new Date object is returned. The amount can be a negative number.

Subtracts one day from the planned job scheduling time and convert the time to the yyyy-MM-dd format.

#{DateUtil.format(DateUtil.addDays(Job.planTime,-1),"yyyy-MM-dd")}

Subtracts one day from the planned job scheduling time and convert the time to the week format.

  • #{DateUtil.format(DateUtil.addDays(Job.planTime,-1),"yyyyw")}

    If Job.planTime is January 7, 2024, value 20241 is returned.

  • #{DateUtil.format(DateUtil.addDays(Job.planTime,-1),"yyyyww")}

    If Job.planTime is January 7, 2024, value 202401 is returned.

Date addHours(Date date, int amount)

After the specified number of hours is added to Date, the new Date object is returned. The amount can be a negative number.

Subtract one hour from the planned job scheduling time and convert the time to the hour format.

#{DateUtil.format(DateUtil.addHours(Job.planTime,-1),"yyyy-MM-dd HH")}

Date addMinutes(Date date, int amount)

After the specified number of minutes is added to Date, the new Date object is returned. The amount can be a negative number.

Subtract one minute from the planned job scheduling time and convert the time to the minute format.

#{DateUtil.format(DateUtil.addMinutes(Job.planTime,-1),"yyyy-MM-dd HH:mm")}

int getDay(Date date)

Obtains the day from the date. For example, if the date is 2018-09-14, 14 is returned.

Obtain the day from the job scheduling plan.

#{DateUtil.getDay(Job.planTime)}

int getMonth(Date date)

Obtains the month from the date. For example, if the date is 2018-09-14, 9 is returned.

Obtain the month from the date.

#{DateUtil.getMonth(Job.planTime)}

int getQuarter(Date date)

Obtains the quarter from the date. For example, if the date is 2018-09-14, 3 is returned.

Obtain the quarter from the date.

#{DateUtil.getQuarter(Job.planTime)}

int getYear(Date date)

Obtains the year from the date. For example, if the date is 2018-09-14, 2018 is returned.

Obtain the year from the date.

#{DateUtil.getYear(Job.planTime)}

Date now()

Returns the current time.

Return the current time accurate to second.

#{DateUtil.format(DateUtil.now(),"yyyy-MM-dd HH:mm:ss")}

long getTime(Date date)

Converts a time of the date type to one of the long type.

Convert the planned job scheduling time to a timestamp.

#{DateUtil.getTime(Job.planTime)}

Date parseDate(String str, String pattern)

Converts the character string to the date by pattern. The pattern is the date and time mode. For details, see Date and Time Mode.

Convert the job start time string to a time accurate to second.

#{DateUtil.parseDate(Job.getPlanTime("yyyy-MM-dd HH:mm:ss:SSS"),"yyyy-MM-dd HH:mm:ss")}

Example

The previous day of the job scheduling plan time is used as the subdirectory name to generate an OBS path. The EL expression is as follows:

#{"obs://test/"+DateUtil.format(DateUtil.addDays(Job.planTime,-1),"yyyy-MM-dd")}

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback