-3

i'm passing a string to a function of mine which needs to turn the string into a date. The string is created by "the user" so it could be anything like:

5p - which means 5pm today (or tomorrow if it's after 5pm), 5:00 - which would mean the next 5 (am or pm). tuesday 5pm - etc

I am aware of the fact that there are certain python modules (partially) acchieving what I am looking for, but I would like to be able to extend these solutions to supply new date formats into my parsing engine.

Is there any library that gets close to this?

phimuemue
  • 34,669
  • 9
  • 84
  • 115
silkcom
  • 492
  • 1
  • 5
  • 14
  • 3
    Will you please post the code you've written so far – That1Guy Jul 26 '13 at 20:49
  • The code i've written so far is just a normal chat bot client that stores chats. I'm adding the ability for it to store reminders. – silkcom Jul 26 '13 at 20:59
  • the natural language time parser isn't quite what I need, but the fuzzy timestamp one seems like it's promising. Maybe i'l submit patches to it if I upgrade it. – silkcom Jul 26 '13 at 21:13

1 Answers1

3

There's parsedatetime which tries to do it but as you can guess it's not perfect - ideally you would have a format, especially since you control the string being passed.

Duplicate: fuzzy timestamp parsing with Python

Community
  • 1
  • 1
Eiyrioü von Kauyf
  • 4,481
  • 7
  • 32
  • 41