carbonKit

package
v3.1.112 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Yesterday 昨天.
	Yesterday func(timezone ...string) carbon.Carbon = carbon.Yesterday

	// Now 当前.
	Now func(timezone ...string) carbon.Carbon = carbon.Now

	// Tomorrow 明天.
	Tomorrow func(timezone ...string) carbon.Carbon = carbon.Tomorrow
)
View Source
var (
	// CreateFromStdTime time.Time => carbon.Carbon
	CreateFromStdTime func(tt time.Time, timezone ...string) carbon.Carbon = carbon.CreateFromStdTime

	// CreateFromDate 从给定的年、月、日创建 Carbon 实例
	CreateFromDate      func(year, month, day int, timezone ...string) carbon.Carbon              = carbon.CreateFromDate
	CreateFromDateMilli func(year, month, day, millisecond int, timezone ...string) carbon.Carbon = carbon.CreateFromDateMilli
	CreateFromDateMicro func(year, month, day, microsecond int, timezone ...string) carbon.Carbon = carbon.CreateFromDateMicro
	CreateFromDateNano  func(year, month, day, nanosecond int, timezone ...string) carbon.Carbon  = carbon.CreateFromDateNano

	// CreateFromDateTime 从给定的年、月、日、时、分、秒创建 Carbon 实例
	CreateFromDateTime      func(year, month, day, hour, minute, second int, timezone ...string) carbon.Carbon              = carbon.CreateFromDateTime
	CreateFromDateTimeMilli func(year, month, day, hour, minute, second, millisecond int, timezone ...string) carbon.Carbon = carbon.CreateFromDateTimeMilli
	CreateFromDateTimeMicro func(year, month, day, hour, minute, second, microsecond int, timezone ...string) carbon.Carbon = carbon.CreateFromDateTimeMicro
	CreateFromDateTimeNano  func(year, month, day, hour, minute, second, nanosecond int, timezone ...string) carbon.Carbon  = carbon.CreateFromDateTimeNano

	// CreateFromTimestamp 从给定的秒级时间戳创建 Carbon 实例
	CreateFromTimestamp      func(timestamp int64, timezone ...string) carbon.Carbon = carbon.CreateFromTimestamp
	CreateFromTimestampMilli func(timestamp int64, timezone ...string) carbon.Carbon = carbon.CreateFromTimestampMilli
	CreateFromTimestampMicro func(timestamp int64, timezone ...string) carbon.Carbon = carbon.CreateFromTimestampMicro
	CreateFromTimestampNano  func(timestamp int64, timezone ...string) carbon.Carbon = carbon.CreateFromTimestampNano

	// CreateFromTime 从给定的时、分、秒创建 Carbon 实例
	CreateFromTime      func(hour, minute, second int, timezone ...string) carbon.Carbon              = carbon.CreateFromTime
	CreateFromTimeMilli func(hour, minute, second, millisecond int, timezone ...string) carbon.Carbon = carbon.CreateFromTimeMilli
	CreateFromTimeMicro func(hour, minute, second, microsecond int, timezone ...string) carbon.Carbon = carbon.CreateFromTimeMicro
	CreateFromTimeNano  func(hour, minute, second, nanosecond int, timezone ...string) carbon.Carbon  = carbon.CreateFromTimeNano
)
View Source
var (
	// Parse 将标准时间字符串解析成 Carbon 实例.
	Parse func(value string, timezone ...string) carbon.Carbon = carbon.Parse

	// ParseByLayout 通过布局模板将时间字符串解析成 Carbon 实例.
	/*
		e.g.
		carbon.ParseByLayout("2020|08|05 13|14|15", "2006|01|02 15|04|05").ToDateTimeString() 						// 2020-08-05 13:14:15
		carbon.ParseByLayout("It is 2020-08-05 13:14:15", "It is 2006-01-02 15:04:05").ToDateTimeString() 			// 2020-08-05 13:14:15
		carbon.ParseByLayout("今天是 2020年08月05日13时14分15秒", "今天是 2006年01月02日15时04分05秒").ToDateTimeString() // 2020-08-05 13:14:15
		carbon.ParseByLayout("2020-08-05 13:14:15", "2006-01-02 15:04:05", carbon.Tokyo).ToDateTimeString() 		// 2020-08-05 14:14:15
	*/
	ParseByLayout func(value, layout string, timezone ...string) carbon.Carbon = carbon.ParseByLayout

	// ParseByFormat 通过格式模板将时间字符串解析成 Carbon 实例.
	/*
		e.g.
		carbon.ParseByLayout("2020|08|05 13|14|15", "2006|01|02 15|04|05").ToDateTimeString() 						// 2020-08-05 13:14:15
		carbon.ParseByLayout("It is 2020-08-05 13:14:15", "It is 2006-01-02 15:04:05").ToDateTimeString() 			// 2020-08-05 13:14:15
		carbon.ParseByLayout("今天是 2020年08月05日13时14分15秒", "今天是 2006年01月02日15时04分05秒").ToDateTimeString() // 2020-08-05 13:14:15
		carbon.ParseByLayout("2020-08-05 13:14:15", "2006-01-02 15:04:05", carbon.Tokyo).ToDateTimeString() 		// 2020-08-05 14:14:15
	*/
	ParseByFormat func(value, format string, timezone ...string) carbon.Carbon = carbon.ParseByFormat
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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