473,799 Members | 3,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date conversion problem *URGENT*

Hey,

I have differnt kind of dates. They can be in this format:

Thur, 23 Sept 2004 14:24:15 GMT
Thur, 23 Sept 2004 14:24:15 PST
Thur, 23 Sept 2004 14:24:15 CST

and so on....

Now when I try to convert this string to a date then I get
the error:

The string was not recognized as a valid DateTime. There
is a unknown word starting at index 0.

If I remove the words GMT, PST, CST then it works. BUT is
there any possiblity to get this converted without remove
these words?

Thanks
Nov 19 '05 #1
5 3505
are you using the System.Convert. ToDateTime ? if so try using DateTime.Parse
method (static on DateTime class)

HTH

Ollie Riches

"Vishal" <an*******@disc ussions.microso ft.com> wrote in message
news:33******** *************** *****@phx.gbl.. .
Hey,

I have differnt kind of dates. They can be in this format:

Thur, 23 Sept 2004 14:24:15 GMT
Thur, 23 Sept 2004 14:24:15 PST
Thur, 23 Sept 2004 14:24:15 CST

and so on....

Now when I try to convert this string to a date then I get
the error:

The string was not recognized as a valid DateTime. There
is a unknown word starting at index 0.

If I remove the words GMT, PST, CST then it works. BUT is
there any possiblity to get this converted without remove
these words?

Thanks

Nov 19 '05 #2
I tried both and got the same result.

Dim dtDate As DateTime = Convert.ToDateT ime(strPostDate )

or

Dim dtDate As DateTime = DateTime.Parse( strPostDate)

BTW: I recognized that when removing GMT doesnt help. I
get: The string was not recognized as a valid DateTime.
There is a unknown word starting at index 0. The first
problem does exist too.
-----Original Message-----
are you using the System.Convert. ToDateTime ? if so try using DateTime.Parsemethod (static on DateTime class)

HTH

Ollie Riches

"Vishal" <an*******@disc ussions.microso ft.com> wrote in messagenews:33******* *************** ******@phx.gbl. ..
Hey,

I have differnt kind of dates. They can be in this format:
Thur, 23 Sept 2004 14:24:15 GMT
Thur, 23 Sept 2004 14:24:15 PST
Thur, 23 Sept 2004 14:24:15 CST

and so on....

Now when I try to convert this string to a date then I get the error:

The string was not recognized as a valid DateTime. There
is a unknown word starting at index 0.

If I remove the words GMT, PST, CST then it works. BUT is there any possiblity to get this converted without remove these words?

Thanks

.

Nov 19 '05 #3
Update If I remove the "t" from "Sept" and "GMT" then it
works.... There must a better way?

-----Original Message-----
are you using the System.Convert. ToDateTime ? if so try using DateTime.Parsemethod (static on DateTime class)

HTH

Ollie Riches

"Vishal" <an*******@disc ussions.microso ft.com> wrote in messagenews:33******* *************** ******@phx.gbl. ..
Hey,

I have differnt kind of dates. They can be in this format:
Thur, 23 Sept 2004 14:24:15 GMT
Thur, 23 Sept 2004 14:24:15 PST
Thur, 23 Sept 2004 14:24:15 CST

and so on....

Now when I try to convert this string to a date then I get the error:

The string was not recognized as a valid DateTime. There
is a unknown word starting at index 0.

If I remove the words GMT, PST, CST then it works. BUT is there any possiblity to get this converted without remove these words?

Thanks

.

Nov 19 '05 #4
you can use a IFormatProvider interface, have a look at the CultureInfo
class, you could also specific the format of the DateTime.Parse i believe

HTH

Ollie Riches

"Vishal" <an*******@disc ussions.microso ft.com> wrote in message
news:1a******** *************** *****@phx.gbl.. .
Update If I remove the "t" from "Sept" and "GMT" then it
works.... There must a better way?

-----Original Message-----
are you using the System.Convert. ToDateTime ? if so try

using DateTime.Parse
method (static on DateTime class)

HTH

Ollie Riches

"Vishal" <an*******@disc ussions.microso ft.com> wrote in

message
news:33******* *************** ******@phx.gbl. ..
Hey,

I have differnt kind of dates. They can be in this format:
Thur, 23 Sept 2004 14:24:15 GMT
Thur, 23 Sept 2004 14:24:15 PST
Thur, 23 Sept 2004 14:24:15 CST

and so on....

Now when I try to convert this string to a date then I get the error:

The string was not recognized as a valid DateTime. There
is a unknown word starting at index 0.

If I remove the words GMT, PST, CST then it works. BUT is there any possiblity to get this converted without remove these words?

Thanks

.

Nov 19 '05 #5
you need to check out DateTime.ParseE xact

HTH

Ollie Riches

"Vishal" <an*******@disc ussions.microso ft.com> wrote in message
news:1a******** *************** *****@phx.gbl.. .
Update If I remove the "t" from "Sept" and "GMT" then it
works.... There must a better way?

-----Original Message-----
are you using the System.Convert. ToDateTime ? if so try

using DateTime.Parse
method (static on DateTime class)

HTH

Ollie Riches

"Vishal" <an*******@disc ussions.microso ft.com> wrote in

message
news:33******* *************** ******@phx.gbl. ..
Hey,

I have differnt kind of dates. They can be in this format:
Thur, 23 Sept 2004 14:24:15 GMT
Thur, 23 Sept 2004 14:24:15 PST
Thur, 23 Sept 2004 14:24:15 CST

and so on....

Now when I try to convert this string to a date then I get the error:

The string was not recognized as a valid DateTime. There
is a unknown word starting at index 0.

If I remove the words GMT, PST, CST then it works. BUT is there any possiblity to get this converted without remove these words?

Thanks

.

Nov 19 '05 #6

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

Similar topics

3
3742
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
9
4321
by: Stefan Bauer | last post by:
Hi NG, we've got a very urgent problem... :( We are importing data with the LOAD utility. The input DATE field data is in the format DDMMYYYY (for days) and MMYYYY (for months). The target data format is european DD.MM.YYYY (for days) and 01.MM.YYYY (for months). The input format is not recognizable as a DATE input to a DB2 LOAD for
1
3604
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,...
15
18896
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract the value in timeonly format by using this command Format(now,"HH:mm:ss") But when I insert it into the Sql Server database, it embadded date value with it. the output looks like that "01/01/1900 08:59:00" in that case time is
2
4406
by: dskpgt | last post by:
Hi I have to Import some date values from a CSV file in to ACCESS 2003 . the Data in the CSV files as 5/11/2006,10:14:52,89127,0,Hu,VID,Success,1,64,56,K,250,* 5/10/2006,07:39:31,9,0,Nabeel,VID,Failure,0,17,64,K,250,* 5/ 9/2006,20:12:55,86411,0,Muni,VID,Success,1,75,76,K,250,* 5/ 8/2006,08:22:13,10,0,Faqir,VID,Success,1,99,52,K,250,*
1
1654
by: goutamkarmakar | last post by:
dear all friends......PLEASE HELP!!!!!!!!! I AM NEW DEVELOPPER ON VB6 AND SQL SERVER 7, WHEN I AM GOING TO INSERT DATE TO SQL TABLE FROM VB THE DATE INSERTING "01/01/1900" IF IM GIVING SQL WITHOUT ' IF I AM GIVING ' THEN GETTING ERROR DATE CONVERSION CHAR TO DATE TIME IT IS URGENT PLEASE HELP!!!!!
44
10236
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
0
787
by: ponvijaya | last post by:
Hi all, i have date format as dd/mm/yy in my table field. I need to convert it into MySql Format YYYY-MM-DD . For example i need to convert the date 09/05/07 to 2007-05-09. Can a any body suggest me the solution.. Its very urgent
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
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10484
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
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
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
9072
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...
0
6805
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
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.