|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can't get rid of the time part of a dateI have a simple query that queries an access database. One of the fields is
date/time. I use this to extract the date from the field in access: CDate(objDataReader("date")).ToString When the webform is viewed, date and time both show up. (eg. 12/12/2005 12:00:00 AM) How do I get rid of the time? I've also tried CDate(objDataReader("date")).Date.ToString Is it the CDate function? Should I not be using that? TIA, Jim It's ToShortDateTime() or something :)
Karl Show quoteHide quote "Jim in Arizona" <tiltow***@hotmail.com> wrote in message news:OGfi0NjEGHA.2912@tk2msftngp13.phx.gbl... >I have a simple query that queries an access database. One of the fields is >date/time. > > I use this to extract the date from the field in access: > CDate(objDataReader("date")).ToString > > When the webform is viewed, date and time both show up. (eg. 12/12/2005 > 12:00:00 AM) How do I get rid of the time? > > I've also tried CDate(objDataReader("date")).Date.ToString > > Is it the CDate function? Should I not be using that? > > TIA, > Jim > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> CDate(objDataReader("date")).ToShortDateStringwrote in message news:ehmkoZjEGHA.2300@TK2MSFTNGP15.phx.gbl... > It's ToShortDateTime() or something :) > > Karl > > -- > http://www.openmymind.net/ > That was it, Karl. Thanks, Jim Jim in Arizona wrote:
Show quoteHide quote > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> I might also recommend the static String.Format method, where you can > wrote in message news:ehmkoZjEGHA.2300@TK2MSFTNGP15.phx.gbl... >> It's ToShortDateTime() or something :) >> >> Karl >> >> -- >> http://www.openmymind.net/ >> > > CDate(objDataReader("date")).ToShortDateString > > That was it, Karl. > > Thanks, > Jim > > define formats like MM/dd/yyyy, as opposed to relying on system settings that could change. Just another option: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemstringclassformattopic1.asp -- craig Microsoft MVP - ASP/ASP.NET
Other interesting topics
possible java script question
Thread not working Timer control PostBack Events on Server Running .NET 1.1 and 2.0 FxCop App Security asp:Wizard inside of a asp:FormView breaks two-way databinding Extend the Membership Provider to include more user data Preserve Data to Edit on DataGrid When Filtering Directory.CreateDirectory - Could not find a part of the path Check textbox value... |
|||||||||||||||||||||||