tags:

views:

142

answers:

2

Is there a equivalent on .net of the string parsing of Datejs ( http://www.datejs.com/ ) ?

I wanna do things like

// Convert text into Date
Date.parse(‘today’);
Date.parse(‘t + 5 d’); // today + 5 days
Date.parse(‘next thursday’);
Date.parse(‘February 20th 1973′);
Date.parse(‘Thu, 1 July 2004 22:30:00′);

Tks!

+2  A: 

The closest thing in the framwork is DateTime.Parse and DateTime.TryParse. Unfortunately, these will only handle your last 2 cases, but the first 3 will not work.

There is no built-in way to do date manipulations using the standard DateTime parsing methods. However, this answer to a different question provides a utility class which will handle some of your other cases (or something similar), using regular expressions.

Reed Copsey
Tks! That will do for me!
Alex Takitani
A: 

As Reed mentions, there is nothing like this built into the .Net framework.

Microsoft JScript is a .Net language that can be used for server-side processing; you might look into seeing if you can integrate Datejs that way.

Aric TenEyck