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
  • One option is always using this inside your page and passing a correctly formatted date in the post back. Commented Aug 6, 2009 at 17:09
  • Good question. I don't know a solution, and it can be very useful. Commented Aug 6, 2009 at 17:10

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.