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

How to format datetime?

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 me to some code sample for the
same

thank you in advance

Nov 15 '05 #1
4 18299
Hi

Construct new Datetime values from value in database
DateTime dt = new DateTime(databasevalue)
then use dt.Date.

HTH
Ravikanth[MVP]

-----Original Message-----
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 getthis value?

It will be helpful if some one could point me to some code sample for thesame

thank you in advance

.

Nov 15 '05 #2
Hi,

Try DateTime.ToShortDateString()

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Vinitha" <vi*******@hotmail.com> wrote in message
news:ez*************@tk2msftngp13.phx.gbl...
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 me to some code sample for the
same

thank you in advance

Nov 15 '05 #3
if you want string, you can use:

DateTime aDateTime = getDateTimeFromDB(some criteria);
string str = aDateTime.Value.ToShortDateString();

"Vinitha" <vi*******@hotmail.com> wrote in message
news:ez*************@tk2msftngp13.phx.gbl...
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 me to some code sample for the
same

thank you in advance

Nov 15 '05 #4

"Vinitha" <vi*******@hotmail.com> wrote in message
news:ez*************@tk2msftngp13.phx.gbl...
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 me to some code sample for the
same

thank you in advance


DateTime theDate .....
theDate.ToString("m/d/yyyy");

if it is the string representation that you want.

Nov 15 '05 #5

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,' : ')" /> ...
5
by: Jack | last post by:
I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What is the easiest way to do this?
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...
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: 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: 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.