-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Hi there,
What would be the best approach to add a function that returns the timezone for a given date (string or otherwise)? I need:
"2001-11-12T10:05:01Z" --> "GMT"
"2001-11-12T10:05:01EST" --> "EST"
Ultimately it is about parsing whatever date and timezone into its components and timezone so that it can be maintained. I don't want the implicit conversion of the timezone when using to_date/1. The plan was to use this bit of code to do that:
to_date(ToTZ, Disambiguate, RawDate) ->
{ExtractedDate, ExtractedTZ} = extract_timezone(RawDate),
{RawDate3, FromTZ} = case try_registered_parsers(RawDate) of
undefined ->
{ExtractedDate, ExtractedTZ};
{ParsedDate,undefined} ->
{ParsedDate,ExtractedTZ};
{ParsedDate,ParsedTZ} ->
{ParsedDate,ParsedTZ}
end,
Thanks,
Rudolph
Metadata
Metadata
Assignees
Labels
No labels