473,405 Members | 2,287 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,405 software developers and data experts.

Date Conversion probs

Hello,

I am trying to convert a date from a string like this:

Dim dtDate As DateTime = Convert.ToDateTime("Sun, 07 Nov
2004 14:05:04 +0200")
Response.Write(dtDate.ToString("dd MMM yyyy"))

However I am getting the error:

"String was not recognized as a valid DateTime. "

Its because of the "+200". What is the best way to convert
such a date?

Thanks
Nov 18 '05 #1
4 1258
Are you asking how to preserve the time zone information in the datetime,
how to adjust for the times zone, or how to lop off the last five characters
of the string to make it acceptable?

"Vishal" <an*******@discussions.microsoft.com> wrote in message
news:4c****************************@phx.gbl...
Hello,

I am trying to convert a date from a string like this:

Dim dtDate As DateTime = Convert.ToDateTime("Sun, 07 Nov
2004 14:05:04 +0200")
Response.Write(dtDate.ToString("dd MMM yyyy"))

However I am getting the error:

"String was not recognized as a valid DateTime. "

Its because of the "+200". What is the best way to convert
such a date?

Thanks


Nov 18 '05 #2
Hello Ken,

I simply want to convert the "Sun, 07 Nov
2004 14:05:04 +0200" to a valid date. Nothing more and
nothing less.

Vishal
-----Original Message-----
Are you asking how to preserve the time zone information in the datetime,how to adjust for the times zone, or how to lop off the last five charactersof the string to make it acceptable?

"Vishal" <an*******@discussions.microsoft.com> wrote in messagenews:4c****************************@phx.gbl...
Hello,

I am trying to convert a date from a string like this:
Dim dtDate As DateTime = Convert.ToDateTime("Sun, 07 Nov
2004 14:05:04 +0200")
Response.Write(dtDate.ToString("dd MMM yyyy"))

However I am getting the error:

"String was not recognized as a valid DateTime. "

Its because of the "+200". What is the best way to convert such a date?

Thanks


.

Nov 18 '05 #3
Just trim the last five or six characters before the conversion.

"Vishal" <an*******@discussions.microsoft.com> wrote in message
news:43****************************@phx.gbl...
Hello Ken,

I simply want to convert the "Sun, 07 Nov
2004 14:05:04 +0200" to a valid date. Nothing more and
nothing less.

Vishal


Nov 18 '05 #4
I was hoping for a conversion solution, but I think there
isnt any. Thanks anyway for your help Ken.

-----Original Message-----
Just trim the last five or six characters before the conversion.
"Vishal" <an*******@discussions.microsoft.com> wrote in messagenews:43****************************@phx.gbl...
Hello Ken,

I simply want to convert the "Sun, 07 Nov
2004 14:05:04 +0200" to a valid date. Nothing more and
nothing less.

Vishal


.

Nov 18 '05 #5

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

Similar topics

3
by: praba kar | last post by:
Dear All, I have doubt regarding date string to time conversion function. In Python I cannot find flexible date string conversion function like php strtotime. I try to use following type...
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
10
by: melissa.nava | last post by:
Here is my code: ***** Public Property DOB() As Date Get Try DOB = (msBirthMonth + "/" + msBirthDay + "/" + msBirthYear)
1
by: Graham Feeley | last post by:
I have a date field named rcdate it is a general date eg: 12/08/2006 3:30:00 PM 12/08/2006 3:00:00 PM I used to update another empty field named rdate with the with using in a update query "...
15
by: edouard.spooner | last post by:
Hi, I have a tricky SQL query problem that I'm having probs with. I have a table which resembles something like this Date | Price1 | Price2 | Price3 01 Jan 2006 | 100 | 100 | 100 02 Jan...
44
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
7
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the following function: CDate(Right(,2) & "/1/" &...
4
by: g0uki | last post by:
Hi all, Hope someone can help, i get the date in the format of 12/12/2008 i 'd like to find out what day this is on, either a weekday/weekend. so output would be: 12/12/2008 midweek: fri 12...
2
by: RN1 | last post by:
A TextBox displays the current date (in dd/mm/yyyy format) & time when a user comes to a page (e.g. 15/10/2008 1:36:39 PM). To convert the date into international format so that the remote server...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.