Skip to content

Commit c754e22

Browse files
committed
add util to print local time
1 parent 3d06d25 commit c754e22

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/algora/shared/util.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,10 @@ defmodule Algora.Util do
284284
def remove_non_ascii(string) do
285285
String.replace(string, ~r/[^a-zA-Z]/, "")
286286
end
287+
288+
def to_local_string(datetime) do
289+
datetime
290+
|> DateTime.shift_zone!("Europe/Athens", Tzdata.TimeZoneDatabase)
291+
|> Calendar.strftime("%Y-%m-%d %H:%M:%S EEST")
292+
end
287293
end

0 commit comments

Comments
 (0)