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

Problem Converting DateTime

Hi,

I have time in the following format...

Tue, 8 May 2007 13:38:00 EDT

How can I convert it DateTime? Convert.ToDateTime works fine if the Time
Zone is GMT like
Tue, 8 May 2007 13:38:00 GMT

Is there a specified way to accomplish this or would I have to do some hacks?

Thnx

May 8 '07 #1
2 1238
Hello mavrick_101,

Use DateTime.ParseExact with
expected format as "string[] expectedFormats = { "ddd", "g", "MMM", "F",
"h", "mm", "ss", "zz"};" (no place to check it)

See MSDN for "Custom DateTime Format Strings" http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

mHi,
m>
mI have time in the following format...
m>
mTue, 8 May 2007 13:38:00 EDT
m>
mHow can I convert it DateTime? Convert.ToDateTime works fine if the
mTime Zone is GMT like Tue, 8 May 2007 13:38:00 GMT
m>
mIs there a specified way to accomplish this or would I have to do
msome hacks?
m>
mThnx
m>
May 8 '07 #2
On May 8, 9:25 pm, mavrick_101 <mavrick...@discussions.microsoft.com>
wrote:
Hi,

I have time in the following format...

Tue, 8 May 2007 13:38:00 EDT

How can I convert it DateTime? Convert.ToDateTime works fine if the Time
Zone is GMT like
Tue, 8 May 2007 13:38:00 GMT

Is there a specified way to accomplish this or would I have to do some hacks?

Thnx
remove EDT
parse date
add time offset

May 8 '07 #3

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

Similar topics

1
by: php newbie | last post by:
Hello, I am trying to insert some date values into a table. I am using ODBC prepared statements to (potentially) improve performance. The statement syntax I am using is this: INSERT INTO...
1
by: antao | last post by:
I'm keeping in the database a log of all the sessions for my application. I'm trying to write a stored procedure that returns all the sessions that; the login contains a certain string, loggedin...
3
by: sunny076 | last post by:
Hi, I am trying to convert from Julian to Gregorian data in C#. I was exploring teh JulianCalendar and Gregorian calendar classes but still not sure how I can do it. For example, the Julian date...
4
by: M. Uppal | last post by:
How do i convert fraction to time in c#. I need to convert 0.25 to time. Excel does this by using Selection.NumberFormat = "h:mm:ss;@" of the Cell Format function. thanks, M. Uppal
7
by: jack | last post by:
Hi all i have just begin csharp have a problem in saving time in database I have to comboboxex in form one containing hours from 0 to 23 and another containig minutes from 0 to 59 the problem...
13
by: Jim Armstrong | last post by:
Hi all - This problem has been driving me crazy, and I'm hoping the answer is something stupid I am neglecting to see.... The procedure posted below is part of an Access/SQL database I have...
8
by: dcedwa3 | last post by:
I'm having a problem with converting a DOB column from nvarchar to a datetime format. I thought the easiest way to do this would be to create another column in the table "DOB2" and run . This fails...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
11
by: =?Utf-8?B?UGFvbG8=?= | last post by:
I have a SQL database table with rows in which the primary key is a DateTime type (although I don't use the Time part). Have added numerous rows and now want to delete one so I enter the date...
1
Manikgisl
by: Manikgisl | last post by:
But the problem is we have dates in Varchar instead Datetime While Converting Varchar To Datetime All four formats are unable to Convert ie select Convert(Datetime,'18-11-2008 2:35:19...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.