IT Community - Software Programming, Web Development and Technical Support

Datetime datatype formate

This is a discussion on Datetime datatype formate within the ASP and ASP.NET Programming forums, part of the Web Development category; Hello, I created a sql table with a field DateTime. I inserted a date value as 2/2/2008 to ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-19-2008, 11:03 PM
Kirubhananth Kirubhananth is offline
D-Web Programmer
 
Join Date: Feb 2008
Location: My native is Madurai but now in Chennai
Posts: 61
Kirubhananth is on a distinguished road
Send a message via AIM to Kirubhananth Send a message via Skype™ to Kirubhananth
Question Datetime datatype formate

Hello,

I created a sql table with a field DateTime. I inserted a date value as 2/2/2008 to this field. While viewing this value from the DB in a textbox i got the value 2/2/2008 12:00 AM. HOw to filter the 12:00 AM and get onlly the date? I wrote the program in ASP.NET.

-Kirubha
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-21-2008, 06:06 AM
prasannavigneshr prasannavigneshr is offline
D-Web Incredible
 
Join Date: Feb 2007
Posts: 1,321
prasannavigneshr is on a distinguished road
Send a message via MSN to prasannavigneshr
Thumbs up Re: Datetime datatype formate

Hi Kirubhananth,

Its very simple to filter the time from the DateTime.

Try this...

Code:
 DateTime.Parse(DBstring).ToShortDateString();

// the DBstring the value you fetched from the database.
hope useful....
__________________
Prasanna Vignesh
MCPD | Web Developer
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-22-2008, 10:35 PM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: Datetime datatype formate

Hi Kirubhananth,

Try this u can get Date-Time in ur required format like this


text1.Text = DateTime.Now.Day.ToString() +"/"+ DateTime.Now.Month.ToString()+"/"+ DateTime.Now.Year.ToString();

Output
Date:23/2/2008
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-10-2008, 03:23 AM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: Datetime datatype formate

Hai,

try this..
DateTime date=DateTime.Now.Date;
DateTime dt=Convert.ToDateTime(date).ToShortDateString()
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/5297-datetime-datatype-formate.html
Posted By For Type Date
DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 03-10-2008 05:42 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
I am getting 'String was not recognised as a valid DateTime' poornima ASP and ASP.NET Programming 2 02-01-2008 11:17 PM
XmlSerializer throws a exception: String was not recognized as a valid DateTime. kingmaker C# Programming 2 01-19-2008 11:19 PM
Storing NULL value to other than string datatype muthuramkumar ASP and ASP.NET Programming 1 03-19-2007 03:17 AM


All times are GMT -7. The time now is 07:22 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0