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

formatting DateTime

Dear :

i have the following datetime in string

string sDateTime = "26/1/2005 10:18:30 AM";

and I need to get the same datetime with the following format

Wed, 26 Jan 2005 10:18:30 +0200

How can I format string to get the needed format
Nov 19 '05 #1
3 1144
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
string sDateTime = "26/1/2005 10:18:30 AM";

and I need to get the same datetime with the following format

Wed, 26 Jan 2005 10:18:30 +0200

How can I format string to get the needed format


Not too sure about the +0200 at the end, but you can format the rest of it
like so:

string sDateTime = "26/1/2005 10:18:30 AM";
sDateTime = Convert.ToDateTime(sDateTime).ToString("ddd, dd MMM yyyy
HH:mm:ss");
Nov 19 '05 #2
System.Convert.ToDateTime(sDateTime).ToString("ddd , d MMM yyyy hh:mm:ss
zzz");

Eliyahu

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
Dear :

i have the following datetime in string

string sDateTime = "26/1/2005 10:18:30 AM";

and I need to get the same datetime with the following format

Wed, 26 Jan 2005 10:18:30 +0200

How can I format string to get the needed format

Nov 19 '05 #3
Note that if you're doing the conversion on a system set to US culture,
you'll need to adjust for that to properly decode dates in the dd/mm/yyyy
format (US is mm/dd/yyyy).
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
System.Convert.ToDateTime(sDateTime).ToString("ddd , d MMM yyyy hh:mm:ss
zzz");

Eliyahu

"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
Dear :

i have the following datetime in string

string sDateTime = "26/1/2005 10:18:30 AM";

and I need to get the same datetime with the following format

Wed, 26 Jan 2005 10:18:30 +0200

How can I format string to get the needed format


Nov 19 '05 #4

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

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
1
by: McGiv | last post by:
Hi, I'm trying to serialise some objects and I've can't get the built in serialisation to output exactly what I want. For the moment I'm implementing the IXmlSerializable interface and doing it...
1
by: Lauchlan M | last post by:
Hi In an ASP.NET application, I am doing the following (dtrData is a data reader that has been loaded with data already): if (dtrData.Read()) { lblEDPresentationTime.Text = (DateTime)...
4
by: darrel | last post by:
I'm binding fileinformation to a repeater and attempting to display the 'lastWriteTime' property as a formatted date. This: <%# DataBinder.Eval(Container.DataItem, "LastWriteTime" %> Gives...
2
by: Mark | last post by:
I am running into a weird problem. I am using the following code: String.Format("{0:0}:{1:00}:{2:00}", Hours.ToString, Minutes.ToString, Seconds.ToString) Just say seconds is set to 1, it...
2
by: TJ | last post by:
Why doesn't this work?\ string _s = String.Format("{0:M/d/yyyy}","5/20/2005 12:00:00 AM); Response.Write(_s); It kicks back the full date and time...I just want the date to show and not the...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
7
by: sherifffruitfly | last post by:
Hi, God I hate datetime string formatting... How do I get a string of the form "04-Oct-2006", for example, from a DateTime object? Thanks a jillion, cdj
1
by: Untitled | last post by:
I have an application that stores all DateTime inforamtion in UTC. However, this application will be accessed from arround the world. I would like my users to be able to specify their prefered...
3
by: Tim | last post by:
Folks, I'm trying to format a print string so that it reports progress whilst processing a looping structure with a date time stamp appended to the end of the string. This started out life as a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.