What is wrong with a line like this? DateTime.Parse(myString)
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
Answer / ish
DateTime.parse("","") will take two parameter one string
and other get other on object
Is This Answer Correct ? | 4 Yes | 7 No |
How to Insert a TextBox value in to Sql database using C# coding?
17 Answers HCL, Sona, TCS,
What is cache in asp net?
What are the asp.net list controls and difference between them?
What is full trust in asp.net?
What is the differences between a primary key and a unique key in sql server?
What is sta?
What is a DLL Hell Problem in .Net?
how to use html code in asp source code?
what are the server controls used in sitepath navigation?
You create an ASP.NET application for a hotel. The application contains a page that displays current weather conditions for the city in which the hotel is located. The application calls an XML Web service every 10 minutes to update the current weather conditions. A new page is then displayed for subsequent requests. You want the same page to be cached and retrieved from the cache during the time between calls to the XML Web service. You decide to use a Page directive to accomplish this goal. Which Page directive should you use? A . <%@ Cache Seconds="600 '' VaryByParam="Page" %> B . <%@ OutputCache Time="600" %> C . <%@ OutputCache Duration="600" VaryByParam="None" %> D . <%@ OutputCache Duration="600" %>
How does session state work in asp.net?
What is active web page?