Skip to content

Utilities

Datetime operations, delay, MD5 hash, and random utilities.

9 modules

ModuleDescription
เพิ่มเวลาเพิ่มเวลาให้กับวันที่เวลา
จัดรูปแบบวันที่เวลาจัดรูปแบบวันที่เวลาเป็นข้อความ
แปลงวันที่เวลาแปลงข้อความเป็นวันที่เวลา
ลบเวลาลบเวลาออกจากวันที่เวลา
วันที่/เวลาปัจจุบันรับวันที่และเวลาปัจจุบัน
หน่วงเวลา/พักหยุดการทำงานของเวิร์กโฟลว์ชั่วคราวตามระยะเวลาที่กำหนด
แฮช MD5คำนวณแฮช MD5 ของข้อความ
ตัวเลขสุ่มสร้างตัวเลขสุ่มในช่วง
ข้อความสุ่มสร้างข้อความสุ่มหรือ UUID

Modules

เพิ่มเวลา

datetime.add

เพิ่มเวลาให้กับวันที่เวลา

Parameters:

NameTypeRequiredDefaultDescription
datetimestringNonowEnter "now" for current time, or ISO 8601 format (e.g., 2024-01-30T14:30:00)
daysnumberNo0Number of days to add (positive) or subtract (negative)
hoursnumberNo0Number of hours to add (positive) or subtract (negative)
minutesnumberNo0Number of minutes to add (positive) or subtract (negative)
secondsnumberNo0Number of seconds to add (positive) or subtract (negative)

Output:

FieldTypeDescription
resultstringผลลัพธ์การดำเนินการ
timestampnumberผลลัพธ์การดำเนินการ

Example: Add 7 days

yaml
datetime: now
days: 7

Example: Add 2 hours 30 minutes

yaml
datetime: 2024-01-15T10:00:00
hours: 2
minutes: 30

จัดรูปแบบวันที่เวลา

datetime.format

จัดรูปแบบวันที่เวลาเป็นข้อความ

Parameters:

NameTypeRequiredDefaultDescription
datetimestringNonowEnter "now" for current time, or ISO 8601 format (e.g., 2024-01-30T14:30:00)
formatselect (%Y-%m-%d, %Y-%m-%d %H:%M:%S, %Y/%m/%d, %d/%m/%Y, %m/%d/%Y, %Y年%m月%d日, %B %d, %Y, %d %b %Y, %H:%M:%S, %H:%M, %I:%M %p, %Y%m%d, %Y-%m-%dT%H:%M:%SZ, %a, %d %b %Y %H:%M:%S)No%Y-%m-%d %H:%M:%SSelect a format or enter custom strftime pattern

Output:

FieldTypeDescription
resultstringผลลัพธ์การดำเนินการ
timestampnumberผลลัพธ์การดำเนินการ

Example: Format current time

yaml
datetime: now
format: %Y-%m-%d %H:%M:%S

Example: Custom date format

yaml
datetime: 2024-01-15T10:30:00
format: %B %d, %Y

แปลงวันที่เวลา

datetime.parse

แปลงข้อความเป็นวันที่เวลา

Parameters:

NameTypeRequiredDefaultDescription
datetime_stringstringYes-DateTime string to parse (ISO 8601 format recommended)
formatselect (%Y-%m-%d, %Y-%m-%d %H:%M:%S, %Y/%m/%d, %d/%m/%Y, %m/%d/%Y, %Y年%m月%d日, %B %d, %Y, %d %b %Y, %H:%M:%S, %H:%M, %I:%M %p, %Y%m%d, %Y-%m-%dT%H:%M:%SZ, %a, %d %b %Y %H:%M:%S)No%Y-%m-%d %H:%M:%SSelect a format or enter custom strftime pattern

Output:

FieldTypeDescription
resultstringผลลัพธ์การดำเนินการ
timestampnumberผลลัพธ์การดำเนินการ
yearnumberผลลัพธ์การดำเนินการ
monthnumberUnix timestamp
daynumberส่วนประกอบปี
hournumberส่วนประกอบเดือน
minutenumberส่วนประกอบวัน
secondnumberส่วนประกอบชั่วโมง

Example: Parse ISO format

yaml
datetime_string: 2024-01-15T10:30:00

Example: Parse custom format

yaml
datetime_string: January 15, 2024
format: %B %d, %Y

ลบเวลา

datetime.subtract

ลบเวลาออกจากวันที่เวลา

Parameters:

NameTypeRequiredDefaultDescription
datetimestringNonowEnter "now" for current time, or ISO 8601 format (e.g., 2024-01-30T14:30:00)
daysnumberNo0Number of days to add (positive) or subtract (negative)
hoursnumberNo0Number of hours to add (positive) or subtract (negative)
minutesnumberNo0Number of minutes to add (positive) or subtract (negative)
secondsnumberNo0Number of seconds to add (positive) or subtract (negative)

Output:

FieldTypeDescription
resultstringผลลัพธ์การดำเนินการ
timestampnumberผลลัพธ์การดำเนินการ

Example: Subtract 7 days

yaml
datetime: now
days: 7

Example: Subtract 1 hour

yaml
datetime: 2024-01-15T10:00:00
hours: 1

วันที่/เวลาปัจจุบัน

utility.datetime.now

รับวันที่และเวลาปัจจุบัน

Parameters:

NameTypeRequiredDefaultDescription
formatselect (iso, unix, unix_ms, date, time, custom)Noisoรูปแบบเอาต์พุต
custom_formatstringNo-รูปแบบ Python strftime (ถ้า format=custom)
timezonestringNoUTCรูปแบบ Python strftime (ถ้า format=custom)

Output:

FieldTypeDescription
statusstringเขตเวลา (ค่าเริ่มต้น: UTC)
datetimestringสถานะการดำเนินการ (success/error)
timestampnumberสถานะการดำเนินการ (success/error)
isostringวันที่/เวลาที่จัดรูปแบบ

Example: Example

yaml
format: iso

Example: Example

yaml
format: unix

หน่วงเวลา/พัก

utility.delay

หยุดการทำงานของเวิร์กโฟลว์ชั่วคราวตามระยะเวลาที่กำหนด

Parameters:

NameTypeRequiredDefaultDescription
duration_msnumberNo1000ระยะเวลาที่จะรอเป็นมิลลิวินาที
duration_secondsnumberNo-ทางเลือก: ระยะเวลาเป็นวินาที

Output:

FieldTypeDescription
statusstringทางเลือก: ระยะเวลาเป็นวินาที
waited_msnumberสถานะการดำเนินการ (success/error)

Example: Example

yaml
duration_seconds: 2

Example: Example

yaml
duration_ms: 500

แฮช MD5

utility.hash.md5

คำนวณแฮช MD5 ของข้อความ

Parameters:

NameTypeRequiredDefaultDescription
texttextYes-ข้อความที่จะแฮช
encodingstringNoutf-8ข้อความที่จะแฮช

Output:

FieldTypeDescription
statusstringการเข้ารหัสข้อความ
hashstringการเข้ารหัสข้อความ

Example: Example

yaml
text: Hello World

ตัวเลขสุ่ม

utility.random.number

สร้างตัวเลขสุ่มในช่วง

Parameters:

NameTypeRequiredDefaultDescription
minnumberNo0ค่าต่ำสุด (รวม)
maxnumberNo100ค่าต่ำสุด (รวม)
decimalsnumberNo0ค่าสูงสุด (รวม)

Output:

FieldTypeDescription
statusstringจำนวนทศนิยม (0 สำหรับจำนวนเต็ม)
valuenumberสถานะการดำเนินการ (success/error)

Example: Example

yaml
min: 1
max: 100
decimals: 0

Example: Example

yaml
min: 0
max: 1
decimals: 2

ข้อความสุ่ม

utility.random.string

สร้างข้อความสุ่มหรือ UUID

Parameters:

NameTypeRequiredDefaultDescription
lengthnumberNo16ความยาวข้อความ
charsetselect (alphanumeric, letters, lowercase, uppercase, numbers, hex, uuid)Noalphanumericความยาวข้อความ

Output:

FieldTypeDescription
statusstringสถานะการดำเนินการ (success/error)
valuestringสถานะการดำเนินการ (success/error)

Example: Example

yaml
length: 16
charset: alphanumeric

Example: Example

yaml
charset: uuid

Released under the Apache 2.0 License.