mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
time: add more UTC/local time conversion functions, make Time.format_rfc3339 more stable
This commit is contained in:
@ -24,7 +24,7 @@ pub fn (t Time) format_ss_milli() string {
|
||||
// RFC3339 is an Internet profile, based on the ISO 8601 standard for for representation of dates and times using the Gregorian calendar.
|
||||
// It is intended to improve consistency and interoperability, when representing and using date and time in Internet protocols.
|
||||
pub fn (t Time) format_rfc3339() string {
|
||||
u := t.add(-offset() * second)
|
||||
u := t.local_to_utc()
|
||||
return '${u.year:04d}-${u.month:02d}-${u.day:02d}T${u.hour:02d}:${u.minute:02d}:${u.second:02d}.${(u.microsecond / 1000):03d}Z'
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user