Skip to content

Commit

Permalink
docs(vrl): add docs for new timezone option in parse_timestamp func…
Browse files Browse the repository at this point in the history
…tion (#22121)

* Add new `timezone` option for `parse_timestamp` function

* Add more explain to the timezone argument in doc

* Update website/cue/reference/remap/functions/parse_timestamp.cue

Co-authored-by: Brett Blue <84536271+brett0000FF@users.noreply.github.com>

* Add more failed reason

* Fix example without DST

---------

Co-authored-by: Brett Blue <84536271+brett0000FF@users.noreply.github.com>
Co-authored-by: Pavlos Rontidis <pavlos.rontidis@gmail.com>
  • Loading branch information
3 people authored Jan 10, 2025
1 parent 1ef01ae commit 5de96d4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion website/cue/reference/remap/functions/parse_timestamp.cue
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@ remap: functions: parse_timestamp: {
required: true
type: ["string"]
},

{
name: "timezone"
description: """
The [TZ database](\(urls.tz_time_zones)) format. By default, this function parses the timestamp by global [`timezone` option](\(urls.vector_configuration)/global-options#timezone).
This argument overwrites the setting and is useful for parsing timestamps without a specified timezone, such as `16/10/2019 12:00:00`.
"""
required: false
type: ["string"]
},
]
internal_failure_reasons: [
"`value` fails to parse using the provided `format`.",
"`value` fails to parse using the provided `timezone`.",
]
return: types: ["timestamp"]

Expand All @@ -34,5 +43,12 @@ remap: functions: parse_timestamp: {
"""#
return: "2020-10-10T16:00:00Z"
},
{
title: "Parse timestamp with timezone"
source: #"""
parse_timestamp!("16/10/2019 12:00:00", format: "%d/%m/%Y %H:%M:%S", timezone: "Asia/Taipei")
"""#
return: "2019-10-16T04:00:00Z"
},
]
}

0 comments on commit 5de96d4

Please sign in to comment.