Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 24th, 2006, 05:16 PM
Authorized User
 
Join Date: Apr 2006
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to retieve only the date not date and time

I have a form with a Calendar Control and a textbox. Where you can select a hire date from the calendar and show it in the textbox and save it in the database as hireDate.This is one part of the form. The second part of the form is , Once the first part of the form is submitted, it opens up another form with all the information in a texbox control .
So to retrieve the HireDate from the database and show it in the textbox control for the hire date field ,
My code is as below

dtremployee = sqlCommand1.ExecuteReader();
if (dtremployee.Read())
{
txthire.Text =String.Format("{0:c}",(string)dtremployee["HireDate"].ToString());
}

But when the date is retrieved it is showing both the date and time-
"7/27/2006 12:00:00 AM"
Can you tell me how to show only the date not the time.

 
Old July 24th, 2006, 10:07 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I do something such as this:

Dim tempDT as dateTime

tempDT = [date value]
txthire.text = format(tempDT, "MM/dd/yyyy")

The same theory should work for you.

"The one language all programmers understand is profanity."
 
Old July 25th, 2006, 01:10 PM
Authorized User
 
Join Date: Apr 2006
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank yoou for your help it is appreciated.






Similar Threads
Thread Thread Starter Forum Replies Last Post
date and time in EST time zone anboss XSLT 1 May 21st, 2008 01:42 PM
Get the time different from two date kumiko Classic ASP Basics 2 March 31st, 2008 10:14 AM
date and time estrela666 Visual Basic 2005 Basics 2 January 5th, 2007 11:28 AM
insert system date. no date and time jimmy Access VBA 6 November 20th, 2003 01:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.