Questions tagged [timex]

26 questions
8
votes
7 answers

Format date with Elixir

I'm trying to format the Timex module to look a certain way. I'm trying to get today's date. but I want it formatted like this: 2017/12/12. year/mn/day In ruby I would go to the strftime class but I'm not sure how to do this with Elixir: Current…
Bitwise
  • 8,021
  • 22
  • 70
  • 161
6
votes
2 answers

Elixir converting datetime to string

I have a raw sql query which returns a datetime field and I want to return a json with those results. If I put the return value I get a complain: (Poison.EncodeError) unable to encode value: {{2017, 3, 21}, {0, 0, 0, 0}} If I try to transform it to…
Romeo Mihalcea
  • 9,714
  • 12
  • 50
  • 102
4
votes
1 answer

Timex strings to datetime in python

I want to convert a list of Timex date format strings (from SUTime) into normal datetime format. The problem is, that I have numerous different types: dates = ['2018-07-09', '2018-W15', '2018-02', '2018-04-06', …
moritz
  • 314
  • 2
  • 12
4
votes
1 answer

How do you parse a date and time string into a type compatible with Elixir's Ecto.DateTime?

In my Phoenix app I have a form with a date/time field that puts datetime value into params in the following format: 2016-11-30 20:00 I can parse it using Timex library: Timex.parse("2016-11-30 20:00", "%Y-%m-%d %H:%M", :strftime) Which results…
Alex Kovshovik
  • 4,085
  • 4
  • 35
  • 36
3
votes
1 answer

`FunctionClauseError` error in `Timex.Timezone.resolve/3` when calling `Timex.Timezone.get/2` for a UTC `DateTime`

I have (what I suspect is) a UTC date-time. I'd like to convert it to my local time (the timezone named America/New_York for that date-time). I was trying to follow the Timex docs: > timezone = Timezone.get("America/Chicago",…
Kenny Evitt
  • 9,291
  • 5
  • 65
  • 93
3
votes
2 answers

Generate a list of dates

Let's say I'm using Timex as follows: use Timex Interval.new(from: ~D[2016-03-03], until: [days: 3]) %Elixir.Timex.Interval{from: ~N[2016-03-03 00:00:00], left_open: false, right_open: true, step: [days: 1], until: ~N[2016-03-06 00:00:00]} I want…
cjm2671
  • 18,348
  • 31
  • 102
  • 161
3
votes
2 answers

set datetime milliseconds precision - elixir

I am trying to get a datetime which has only 3 digits in the sub-second part. Using timex I get the following result: …
fay
  • 2,086
  • 2
  • 14
  • 36
2
votes
1 answer

using Timezone.convert when dates are on different sides of DST

Dates are passed to the backend in UTC, and I want to convert time to a given TZ. I'm running into a bug as March 10th is in a different DST for UTC than my test TZ (America/Los_Angeles). date = #DateTime<2019-03-10 02:25:19.464342Z> timezone =…
Peter R
  • 3,185
  • 23
  • 43
2
votes
1 answer

Setting path in heidelTime property file to use Stanford POS Tagger for German?

I am trying to detect temporal information in German text. I tried using the Stanford CoreNLP pipeline as it would be very helpful to make use of dependency parse information in later stages (after temporal tagging) but to my understanding there is…
2
votes
1 answer

Elixir/Phoenix/Timex: protocol Timex.Protocol not implemented for :error

I'm trying to parse a date and save it into a table. Here's the function: defp string_to_datetime(string) do result = string |> String.split(";") |> List.last |> Timex.parse("{0M}/{0D}/{YYYY} {h12}:{m} {AM}") …
t56k
  • 6,769
  • 9
  • 52
  • 115
2
votes
6 answers

java.io.FileNotFoundException: class path resource [timex-servlet.properties] cannot be opened because it does not exist

I'm getting the following error message when I try to start a spring web application: 2012-04-12 13:53:20,491 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization…
opike
  • 7,053
  • 14
  • 68
  • 95
1
vote
1 answer

Luis Test Tool Datetime different than Locally Resolved Datetime

I have a Luis model created for a bot skill. I'm using the prebuilt datetime entity for dates. When I give sample utterance such as "Sell 5k [jargon] for this weekend at [jargon]" on the Luis portal's test tool, I get the response I expect (shown…
1
vote
1 answer

Elixir - Timex detecting when British Summer Time starts and ends

I found out that Timex.Timezone.convert(t, "Europe/London") returns a DateTime object of this format: #. My question is when BST ends in October, will Timex.Timezone.convert(t,…
Bargain23
  • 1,863
  • 3
  • 29
  • 50
1
vote
0 answers

Python: How to parse Timex3 into datetime or equivalent

In my Python3 project, I use SUTime together with Stanford CoreNLP to retrieve normalized time expression in the Timex3 standard. I access CoreNLP using pycorenlp. How can I parse the resulting time expression in Timex3 (part of the TimeML standard)…
pedjjj
  • 958
  • 3
  • 18
  • 40
1
vote
0 answers

Timex - using datetime with a migration

I've got the following module : defmodule SoundButtonsApi.Accounts.Session do use Ecto.Schema use Timex import Ecto.Changeset schema "accounts_sessions" do field :expires_at, Timex.Ecto.DateTime, null: false field :token, :string,…
Kernael
  • 3,270
  • 4
  • 22
  • 42
1
2