What is wrong with a line like this? DateTime.Parse(myString)

Answers were Sorted based on User's Feedback



What is wrong with a line like this? DateTime.Parse(myString)..

Answer / anand

Nothing wrong with the format really. Only problem is that
the result would depend on the Culture of the machine where
this line is getting invoked. Ideally you should also
supply the second parameter - or specify the Culture!

Is This Answer Correct ?    8 Yes 2 No

What is wrong with a line like this? DateTime.Parse(myString)..

Answer / fusion

No .it can have one argument.
Eg. Response.Write(DateTime.Parse("10:50:39"))
will return you date and time.
such as 24/06/2008 10:50:39 AM

You can not simply have any irrlevant string,it should be
some string containing data or time value.

Is This Answer Correct ?    8 Yes 5 No

What is wrong with a line like this? DateTime.Parse(myString)..

Answer / soner gönül

- Different cultures uses different standard date and time formats. This overload can create ambiguous values for the same string in different cultures. Eg: What should "01/02/2016" parsed as? 1 February? 2 January? It depends.

- The Calendar used by CurrentCulture might not have this date and time because of it's boundries.

If anyone interested, I wrote an article in Turkish about that subject.

http://sonergonul.net/datetime-parse-string-kullanmayi-birakamaz-miyiz/

Is This Answer Correct ?    2 Yes 0 No

What is wrong with a line like this? DateTime.Parse(myString)..

Answer / rahul misra

A statement like this should be used only after making sure
that the string contains DateTime data.
e.g DateTime.Parse("3 4") will return 3rd April 2009
(current year assuming DD-MM-YYYY as the datetime format as
per the machine's settings)

Is This Answer Correct ?    2 Yes 2 No

What is wrong with a line like this? DateTime.Parse(myString)..

Answer / ish

DateTime.parse("","") will take two parameter one string
and other get other on object

Is This Answer Correct ?    4 Yes 7 No

Post New Answer

More ASP.NET Interview Questions

What do you mean by authentication and authorization

3 Answers  


One application have three forms for registration .submit button is at third form.after filling three forms only u have to click submit button.After clicking the submit button all the values in first,second& third form saved on sql server.how to handle this situation .

6 Answers   TCS,


What is difference between singleton and single call?

0 Answers  


what is a .xap file? Explain with an example.

0 Answers  


What is State Management in .Net and how many ways are there to maintain a state in .Net?

6 Answers  






What is connection pooling and how to enable and disable connection pooling?

0 Answers  


What methods are fired during the page load?

2 Answers  


what is use of doctype tag in asp.net

1 Answers   TCS, Wipro,


How to display Alert in ASP.NET

0 Answers   HCL,


Explain About WebService

0 Answers   BirlaSoft,


how can u create the blog in asp.net with C#?what is the data type u will use to store in sql server?

0 Answers   IBM,


How does cookies work in asp net?

0 Answers  


Categories