datetime

package
v0.5.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package datetime 提供日期时间处理工具

支持日期时间格式化、解析、计算、时区转换等功能。 适用于 Agent 需要处理时间数据的场景。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tools

func Tools() []tool.Tool

Tools 返回日期时间工具集合

Types

type DateTimeComponents

type DateTimeComponents struct {
	Year        int    `json:"year"`
	Month       int    `json:"month"`
	MonthName   string `json:"month_name"`
	Day         int    `json:"day"`
	Hour        int    `json:"hour"`
	Minute      int    `json:"minute"`
	Second      int    `json:"second"`
	Weekday     int    `json:"weekday"`
	WeekdayName string `json:"weekday_name"`
	YearDay     int    `json:"year_day"`
	ISOWeek     int    `json:"iso_week"`
	Quarter     int    `json:"quarter"`
	IsLeapYear  bool   `json:"is_leap_year"`
}

DateTimeComponents 日期时间组件

type DateTimeDiff

type DateTimeDiff struct {
	Years        int     `json:"years"`
	Months       int     `json:"months"`
	Days         int     `json:"days"`
	Hours        int     `json:"hours"`
	Minutes      int     `json:"minutes"`
	Seconds      int     `json:"seconds"`
	TotalDays    float64 `json:"total_days"`
	TotalHours   float64 `json:"total_hours"`
	TotalMinutes float64 `json:"total_minutes"`
	TotalSeconds float64 `json:"total_seconds"`
	Positive     bool    `json:"positive"`
}

DateTimeDiff 日期差值

type DateTimeOutput

type DateTimeOutput struct {
	ISO8601    string `json:"iso8601"`
	Unix       int64  `json:"unix"`
	Year       int    `json:"year"`
	Month      int    `json:"month"`
	Day        int    `json:"day"`
	Hour       int    `json:"hour"`
	Minute     int    `json:"minute"`
	Second     int    `json:"second"`
	Weekday    string `json:"weekday"`
	DayOfYear  int    `json:"day_of_year"`
	WeekOfYear int    `json:"week_of_year"`
	Timezone   string `json:"timezone"`
}

DateTimeOutput 日期时间输出

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL