
Security News
Node.js TSC Declines to Endorse Feature Bounty Program
The Node.js TSC opted not to endorse a feature bounty program, citing concerns about incentives, governance, and project neutrality.
github.com/sinlovgo/timezone
in go mod project
# test version info
$ git ls-remote -q http://github.com/sinlovgo/timezone.git
# test depends see full version
$ go list -v -m -versions github.com/sinlovgo/timezone
# or use last version add go.mod by script
$ echo "go mod edit -require=$(go list -m -versions github.com/sinlovgo/timezone | awk '{print $1 "@" $NF}')"
$ echo "go mod vendor"
import "github.com/sinlovgo/timezone"
func main() {
// use set of second time string
timezone.Second()
// use set of micro time string
timezone.Micro()
// timestamp unix
timezone.TimestampSecond()
// timestamp unix nano
timezone.TimestampUnixNano()
// UTC string
timezone.UTCSecond()
// UTC string as Micro
timezone.UTCMicro()
// use Asia/Shanghai
timezone.SetZoneByName(timezone.ZoneAsiaShanghai)
timezone.ZoneUTC
timezone.ZoneGMT
timezone.ZoneCET
timezone.ZoneCST
// this location
timezone.SetZoneLocation()
timezone.ZoneCEST
}
format for golang
import "github.com/sinlovgo/timezone"
timezone.LayoutSecond
timezone.LayoutMicro
timezone.LayoutISO8601TimeSecond
timezone.LayoutISO8601TimeMicro
timezone.LayoutISO8601TimeUTC
import "github.com/sinlovgo/timezone"
func main() {
// use set of second time string
timezone.Second()
// use set of micro time string
timezone.Micro()
// timestamp unix
timezone.TimestampSecond()
// timestamp unix nano
timezone.TimestampUnixNano()
// UTC string
timezone.UTCSecond()
// UTC string as Micro
timezone.UTCMicro()
// use Asia/Shanghai
timezone.SetZoneByName(timezone.ZoneAsiaShanghai)
// this location
timezone.SetZoneLocation()
}
import "github.com/sinlovgo/timezone"
func main() {
timestamp, err := timezone.ParseTimestamp("2006-01-02 15:04:05", "2018-07-11 15:07:51")
timestampSecond, err := timestamp.ParseTimestampSecond("2018-07-11 15:07:51")
}
import "github.com/sinlovgo/timezone/timeparse"
func main() {
testTime := "2020-02-25T16:52:18Z"
parseLocation, err := Location(timezone.LayoutISO8601TimeSecond, timezone.LayoutISO8601TimeMicro,
testTime,
timezone.ZoneUTC, timezone.ZoneAsiaShanghai)
}
import "github.com/sinlovgo/timezone"
func main() {
timeFrom := "2018-07-11 15:07:51"
timeTo := "2018-07-12 15:07:51"
compareLocationEQ, err := timestamp.CompareEQ(timeFrom, timeTo, "2006-01-02 15:04:05")
timeFrom := "2018-07-11 15:07:51"
timeTo := "2018-07-12 15:07:51"
compareLocation, err := timestamp.CompareGT(timeFrom, timeTo, timestamp.LayoutSecond)
timeFrom := "2018-07-11 15:07:51"
timeTo := "2018-07-12 15:07:51"
compare, err := timestamp.CompareSecondLT(timeFrom, timeTo)
}
import "github.com/sinlovgo/timezone"
func main() {
calcDurationSecond := time.Duration(-30) * time.Minute
calcDuration := timestamp.CalcDuration(calcDurationSecond, timestamp.LayoutMicro)
calcDateSecond := timestamp.CalcDateSecond(2, 3, 10)
calcDateMicro := timestamp.CalcDateMicro(2, 2, 2)
calcDay := timestamp.CalcDay(10, LayoutSecond)
calcDaySecond := timestamp.CalcDaySecond(1)
calcMonthSecond := timestamp.CalcMonthSecond(-1)
calcYearSecond := timestamp.CalcYearSecond(-1)
}
import "github.com/sinlovgo/timezone"
func main() {
yesterdaySecond := StartDaySecond(-1)
lastMonthMicro := StartMonthMicro(-1)
lastYearSecond := StartYearSecond(-1)
}
make init
make test
add main.go file and run
make run
base docker file can replace
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Node.js TSC opted not to endorse a feature bounty program, citing concerns about incentives, governance, and project neutrality.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.