473,396 Members | 1,599 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,396 software developers and data experts.

DateTime Formating

I hav a log.txt file which contains following DateTime format > Fri May 06
18:05:54 GMT+05:30 2005 . so plzz help me how to accept this format & update
in my DataBase, so that my webapplication DataGrid can display above DateTime
format.
Nov 17 '05 #1
2 1917
On Fri, 6 May 2005 07:40:05 -0700, sudip wrote:
I hav a log.txt file which contains following DateTime format > Fri May 06
18:05:54 GMT+05:30 2005 . so plzz help me how to accept this format & update
in my DataBase, so that my webapplication DataGrid can display above DateTime
format.


string str = "Fri May 06 18:05:54 GMT+05:30 2005";
DateTime dt = DateTime.ParseExact(str, "ddd MMM dd HH:mm:ss 'GMT'zzz yyyy",
DateTimeFormatInfo.CurrentInfo);

Should do it.
--
Tom Porterfield
Nov 17 '05 #2
Hi Tom
Thanks a ton for the mail, it has really helped me to read the DateTime from
the log.text file , but how do update this format into my SQL database coz in
my database table there is a Column named "DateTimeIn" which is unable accept
this
format > Fri May 06 18:05:54 GMT+05:30 2005.

Thanx !!


"Tom Porterfield" wrote:
On Fri, 6 May 2005 07:40:05 -0700, sudip wrote:
I hav a log.txt file which contains following DateTime format > Fri May 06
18:05:54 GMT+05:30 2005 . so plzz help me how to accept this format & update
in my DataBase, so that my webapplication DataGrid can display above DateTime
format.


string str = "Fri May 06 18:05:54 GMT+05:30 2005";
DateTime dt = DateTime.ParseExact(str, "ddd MMM dd HH:mm:ss 'GMT'zzz yyyy",
DateTimeFormatInfo.CurrentInfo);

Should do it.
--
Tom Porterfield

Nov 17 '05 #3

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

Similar topics

4
by: Saso Zagoranski | last post by:
Hi! I have created an SqlCommand object and I have set some parameters to it... One of the parameters is of the DateTime type; here is the code: sqlCommand.Parameters.Value =...
2
by: Jeff Shantz | last post by:
Hello, I'm developing a large statistics application for a call center. It often needs to calculate time spanning over months. For example, an agent's total talk time within 30 days. Since an...
15
by: Fritz Switzer | last post by:
I'd like to have a string assigned the value of a DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" format. For example: DateTime.Now.AddMinutes(30) returns "00:30" ...
1
by: Alpha | last post by:
When I select a datetime variable into a dataset does that stay a datetime column? I specified it to be so in the dataset but having problem formating it in the Crystal. Thanks, Alpha ...
2
by: Peter Kirk | last post by:
Hi there I would like some help with parsing date strings to DateTime structures. I can see that DateTime has Parse and ParseExact methods - but I am not sure what is best for me to use, and...
3
by: Tayo | last post by:
How do I format a datetime datfield to show only dates in a datagrid control
2
by: Tim::.. | last post by:
Hi I'm trying to create a pager that allows you to show records by year and month! I am getting close but would really appritiate some help! Can someone please tell me how I convert the value of...
5
by: A.M | last post by:
Hi, I have a datetime value and want to format it to "June 1, 2006" shape. How can I do that? Thank you,
5
by: Jeff User | last post by:
Hi all The date values in my dropdown list appear as mm/dd/yyyy Specifically, the day always contains 2 digits. I need to set the selected index of the dropdown to the date that equals another...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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...
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
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.