473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Date & time


DateTime dd = DateTime.ParseExact
("27/09/2003", "dd/MM/yyyy");

I still get an error :
"(939): No overload for method 'ParseExact' takes '2'
arguments"

-----Original Message-----
Dates of that format are ambiguous. It's probably trying to parse this asMM/dd/yyyy. Clearly this specific date is dd/MM/yyyy but the parser doesn'ttry to figure that out. You can use DateTime.ParseExact, e.g.
DateTime dd = DateTime.ParseExact ("27/09/2003", "dd/MM/yyyy");
See the documentation for DateTime.Parse to see some more flexible examplesof how to do this without explicitly specifying the format.

"Yosi" <yo*******@hotmail.com> wrote in message
news:11****************************@phx.gbl...


Why i cann't convert date to DateTime :
System.DateTime dd= Convert.ToDateTime("27/09/2003");
How to do that , tjis one thowes an exception .

I can't find a Date class

Nov 15 '05 #1
2 1779
[Yosi] <yo*******@hotmail.com> wrote:
DateTime dd = DateTime.ParseExact
("27/09/2003", "dd/MM/yyyy");

I still get an error :
"(939): No overload for method 'ParseExact' takes '2'
arguments"


As suggested before, look up DateTime.ParseExact in the documentation.

You'll find it takes either three or four parameters. You probably want
the version taking three - there are examples in the MSDN for what you
might want to use.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
Sorry, forgot the IFormatProvider parameter:

DateTime dd = DateTime.ParseExact("27/09/2003", "dd/MM/yyyy", null);
"[Yosi]" <yo*******@hotmail.com> wrote in message
news:10****************************@phx.gbl...

DateTime dd = DateTime.ParseExact
("27/09/2003", "dd/MM/yyyy");

I still get an error :
"(939): No overload for method 'ParseExact' takes '2'
arguments"

-----Original Message-----
Dates of that format are ambiguous. It's probably trying

to parse this as
MM/dd/yyyy. Clearly this specific date is dd/MM/yyyy but

the parser doesn't
try to figure that out. You can use DateTime.ParseExact,

e.g.

DateTime dd = DateTime.ParseExact

("27/09/2003", "dd/MM/yyyy");

See the documentation for DateTime.Parse to see some

more flexible examples
of how to do this without explicitly specifying the

format.


"Yosi" <yo*******@hotmail.com> wrote in message
news:11****************************@phx.gbl...


Why i cann't convert date to DateTime :
System.DateTime dd= Convert.ToDateTime("27/09/2003");
How to do that , tjis one thowes an exception .

I can't find a Date class

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gerry | last post by:
Help needed with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time 6 hours wrong. The time should be GMT...
4
by: Gerry | last post by:
As I'm not a PHP-prgrammer at all, I just need Help with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time...
4
by: Funnyweb | last post by:
I have just notices that the date() function is not returning the correct date/time on my "server". I am running apache2 on my winxp pro laptop. My system clock is set to the correct date,...
1
by: John | last post by:
Hi I am using and access datetime field to store both date & time. How can I split it into date & time after reading the field and then combine the date & time back into datetime when storing...
6
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital...
3
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn...
1
by: aRTx | last post by:
<? /* Directory Listing Script - Version 2 ==================================== Script Author: Artani <artan_p@msn.com>. www.artxcenter.com REQUIREMENTS ============ This script requires...
1
by: jonny | last post by:
Option Explicit Private mdTarget1 As Date Private mdTarget2 As Date ' called on form load Public Sub SetRecordStartTime() mdTarget1 = DateAdd("n", 60, Time) mdTarget2 = DateAdd("n", 120,...
1
by: adeebraza | last post by:
Hi, Every Body Following is code for Showing Actual Date & Time on the form and also record Date & Time of an event. See the following and use Call Modified when you want to record an event in...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.