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

DateTime format

Hi,

When I retrieve urn:schemas:httpmail:date field, how do I set the format
from VB.net code? I assume I should have several DateTime formats to choose
from.
Or is there any VB.net class to convert this field to a format I specify?
Thanks.

Li

Nov 22 '05 #1
1 2248
Li Weng wrote:
When I retrieve urn:schemas:httpmail:date field, how do I set the format
from VB.net code? I assume I should have several DateTime formats to choose
from.
Or is there any VB.net class to convert this field to a format I specify?
Thanks.

You can pass a DateTimeFormatInfo invariant to the the DateTime.ToString
method to specify the format.

Below is a table of format strings and the resulting date format.
d :08/17/2000
D :Thursday, August 17, 2000
f :Thursday, August 17, 2000 16:32
F :Thursday, August 17, 2000 16:32:32
g :08/17/2000 16:32
G :08/17/2000 16:32:32
m :August 17
r :Thu, 17 Aug 2000 23:32:32 GMT
s :2000-08-17T16:32:32
t :16:32
T :16:32:32
u :2000-08-17 23:32:32Z
U :Thursday, August 17, 2000 23:32:32
y :August, 2000
dddd, MMMM dd yyyy :Thursday, August 17 2000
ddd, MMM d "'"yy :Thu, Aug 17 '00
dddd, MMMM dd :Thursday, August 17
M/yy :8/00
dd-MM-yy :17-08-00

To format using one of the above date formats you can do this.

DateTime.Now.ToString("D",DateTimeFormatInfo.Invar iantInfo) ' Gives:
Thursday, August 17, 2000

Remember that the result varies by culture.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
Nov 22 '05 #2

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

Similar topics

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" ...
38
by: nobody | last post by:
I know that given a FormatString and a DateTime you can use DateTime.ToString(...) to convert the DateTime to a String. My question is how can you turn that around? Given a String and a...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
11
by: Cor Ligthert | last post by:
Hello everybody, Jay and Herfried are telling me every time when I use CDate that using the datetime.parseexact is always the best way to do String to datetime conversions. They don't tell why...
4
by: Arpan | last post by:
A SQL Server 2005 DB table has 4 columns namely "ID" (IDENTITY int column), "FirstName" (varchar(50)), "LastName" (varchar(50)) & "DOB" (datetime). Now when I am trying to add a new row using the...
5
by: js | last post by:
I have a textbox contains text in the format of "yyyy/MM/dd hh:mm:ss". I need to parse the text using System.DateTime.Parse() function with custom format. I got an error using the following code. ...
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...
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...
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: 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: 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: 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
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...

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.