473,324 Members | 2,417 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.

How do I format DateTime as mmddyyyy

I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What
is the easiest way to do this?
Nov 16 '05 #1
5 43457
Never mind... found the pattern ("MMddyyyy").

(I was using "mmddyyyy")
Nov 16 '05 #2
Use the ToString overload and pass the format required in it.

Eg:
dt.ToString("mmddyyyy"); or
dt.ToString("dd-mm-yy");
--
Rakesh Rajan
"Jack" wrote:
I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What
is the easiest way to do this?

Nov 16 '05 #3
That is what I was attempting but found a nuance... mmddyyyy formats as
minute, day, month. The correct format is MMddyyyy.

"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Use the ToString overload and pass the format required in it.

Eg:
dt.ToString("mmddyyyy"); or
dt.ToString("dd-mm-yy");
--
Rakesh Rajan
"Jack" wrote:
I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What is the easiest way to do this?

Nov 16 '05 #4
Jack wrote:
I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What
is the easiest way to do this?

DateTime dt = DateTime.Now;

System.Console.WriteLine(string.Format("{0,2:00}{1 ,2:00}{2,04:0000}",dt.Day,dt.Month,dt.Year));
Nov 16 '05 #5
anon <a@a.com> wrote:
Jack wrote:
I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What
is the easiest way to do this?

DateTime dt = DateTime.Now;

System.Console.WriteLine(string.Format("{0,2:00}{1 ,2:00}{2,04:0000}",dt.Day,dt.Month,dt.Year));


or alternatvely:

dt.ToString("MMddyyyy");

/J\
Nov 16 '05 #6

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

Similar topics

1
by: Ted | last post by:
I would like to format my date "06/08/2003 12:00" to something like "1 day ago" or "24 hours ago". Is there a date format I can use to do this or does anyone have any pointers as to how i could do...
0
by: Johan den Boer | last post by:
Hi How to format this datetime format 2003-11-09 08:58:59 to Sun, November 9 2003 8:58am
5
by: cody | last post by:
Iam using Beta2 of VS2005 and getting the error "Error 4 'format-dateTime()' is an unknown XSLT function" at the following line: <xsl:value-of select="format-dateTime($pubDate,' : ')" /> ...
4
by: Vinitha | last post by:
Hi, I 've ("9/27/2003 12:11:31 PM") this value in database . i need to get only this value ("9/27/2003 " ) .How will i format it to get this value? It will be helpful if some one could point...
1
by: Doug Swanson | last post by:
I'm trying to get a datetime value (10/24/2001 6:00 AM) to display as 10/24/01 6:00. I know I could hard code some format but I'm trying to use the culture info etc. so that (and this is my...
1
by: oscar | last post by:
Hi expart, I have facing the problem of formatting the datetime in Dropdownlist. I am using Data Reader to retrive the date data from Sql2000 server and bind to DropDownList Control. The default...
2
by: JC Voon | last post by:
hi: Is there a function to format the datetime value to the following format 2005-09-29T17:57:03.0000000+08:00 ? currently i'm using a hard way Dim result As String
2
by: Dabbler | last post by:
I can't figure out how to format a Label containing a datetime value in a GridView . <asp:TemplateField> <ItemTemplate> <asp:Label ID="JoinDate" runat="server" Text='<%# Eval("JoinDate") %>'...
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,
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...
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: 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: 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
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.