datetime.parse and making it work with a specific format

I have a datetime coming back from an XML file in the format:

20080916 11:02

as in

yyyymm hh:ss

How can i get the datetime.parse function to pick up on this? Ie parse it without erroring? Cheers

Making list with specific name

Hi how can I make a list with specific name , for example making this list with name myList = ( 1 2 3 4 5 ). thanks

Regex for specific url format

I am trying to get a regex expression to match a specific url format. Specifically the api urls for stackexchange. For example I want both of these to match:

Making PopupMenu work

I having trouble on how to implement this Popup Menu. Im using ListActivity, and i dont know how to make this Popup Menu work. Can you please help me with this? public View getView(final int position

Parse specific date string format

I have read a lot of questions and searched for a lot of libs all over the internet but I can’t find one that can do this quickly. I want to parse a specific date in a specific date format like this:

NSDate in specific format

How do I get Todays date in April 27 this format and compare with same string in iphone sdk.

JFormattedTextField currency format for specific locale

i have used the information in the below link to display the currency format for specific locale : How to change the format of a JFormattedTextField? But the format is not changing, when changing the

Applying specific cell data format using POI

I need to apply specific data format to cell. XSSFCellStyle cellStyle = workBook.createCellStyle(); XSSFDataFormat format = workBook.createDataFormat(); cellStyle.setDataFormat(format.getFormat(m/d/y

r Date conversion specific format

I have a date in POSIXlt format: mydate [1] 2011-12-25 15:47:21 and I want a character string 12/25/2011 I have tried using mydate$mon+1/mydate$mday/mydate$year+1900 but I have problems making

Specific Date Format in mysql

Using MySQL Table ID Date 001 2010-05-01 002 2010-06-08 Query Select ID, Date from table; I want to display a date in a specific format Expected Output ID Date 001 01-Mar-2010 002 08-June-2010 How

Reading file in specific format

I have a rather simple C++-problem, but coming from a C-background I am not really aware of all the I/O capabilities of C++. So here is the problem: I have a simple .txt file with a specific format, t


DateTime.ParseExact(input,"yyyyMMdd HH:mm",null);

assuming you meant to say that minutes followed the hours, not seconds – your example is a little confusing.

The ParseExact documentation details other overloads, in case you want to have the parse automatically convert to Universal Time or something like that.

As @Joel Coehoorn mentions, there’s also the option of using TryParseExact, which will return a Boolean value indicating success or failure of the operation – I’m still on .Net 1.1, so I often forget this one.

If you need to parse other formats, you can check out the Standard DateTime Format Strings.

Thanks for the tip, i used this to get my date “20071122” parsed, I needed to add datetimestyles, I used none and it worked:

DateTime dt = DateTime.MinValue;

DateTime.TryParseExact(“20071122”, “yyyyMMdd”, null,System.Globalization.DateTimeStyles.None,out dt);