473,802 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date Conversion probs

Hello,

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

Dim dtDate As DateTime = Convert.ToDateT ime("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 1282
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*******@disc ussions.microso ft.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.ToDateT ime("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*******@disc ussions.microso ft.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.ToDateT ime("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*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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
3743
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 function 1) parsedate function failed if a date string like below format "16-MAY-2005 01:26" 2)parsedate_tz function also failed if a date string
1
3605
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 it works. I never get errors, and if I don't try to update the date fields, I always update the expected number of rows (1). When I do date conversion using the same conversion function, then call CRowset::Add() to add a record to the same table,...
10
1681
by: melissa.nava | last post by:
Here is my code: ***** Public Property DOB() As Date Get Try DOB = (msBirthMonth + "/" + msBirthDay + "/" + msBirthYear)
1
1841
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 " Left(Ratings!RCDate,10)" This now does not work for some reason gives me the error "undefined function in left function"
15
5967
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 2006 | 100 | 100 | 100 03 Jan 2006 | 100 | 100 | 100
44
10239
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
3014
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/" & Left(,4)) I entered the string "200715" in a record to test an error condition.
4
1789
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 december I'm also trying to do it the hard way, without the use of any modules .. i feel this will help my perl skills.
2
5155
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 doesn't generate any error, this is what I am doing: --------------------------- Dim strSDate As String Dim strSTime As String Dim strStartDT As String Dim strSDateTime As String
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10068
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.