views:

330

answers:

2

Is there a natural language parser for date/times in javascript?

+8  A: 

Does Date.js satisfy your needs? Or are you looking for something else?

Nosredna
I found that, but the source code scares me, on multiple levels. I was hoping for something that integrates with one of the 'modern' javascript libraries.
antony.trupe
What scares you, the extension of native objects? Or something else?
Nosredna
on the surface, the lack of formatting and/or lack of a development version and production version. Its also not an active project, which may not be relevant to everyone.
antony.trupe
I've never seen anything close to it, though, especially all the localization. Let us know if you find something else. Maybe someone should take it over as a project.
Nosredna
There were changes made in svn in late 2008, so it's not TOO far out of date.
Nosredna
A: 

W3School

The parse() method takes a date string and returns the number of milliseconds since midnight of January 1, 1970.

Date.parse("2009/04/01")

1238536800000

Date.parse("2009/04/01 13:00:00")

1238583600000

new Date(Date.parse("2009/04/01"))

Wed Apr 01 2009 00:00:00 GMT+0200

Spark
@Spark Unfortunaly the user asked for a "natural language" parser. Something that could parse, say, "next friday at 8 pm" and return "2009-06-19 20:00"
Paulo Santos
@Paulo Santos What's unfortunate about my question? :P
antony.trupe