Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cutting time off of date

Status
Not open for further replies.

chezealot9

Programmer
Jun 17, 2003
50
0
0
US
Hey Guys, when Im inserting a date into a label its attaching 1200AM to it, how can I get cut this part off? Im converting it with reader.getsqldatetime....

Thank you very much for any help!!
 
Whats the best way to do that because its stored in the database as a shortdate?
 
reader.getsqldatetime is the problem - is there another method that extracts the data as just a date or a short date?
 
if you are using sql server you can use convert

ex

SELECT Convert(char(10),DtMyDate,101)
FROM MyTable
 
IS there any sort of convenient string function I can use to just chop off the time, because it'd be like _/_/_ 1200AM so I could drop it after the space in the vb code?

Thanks for your help guys!!
 
Have you used "FormatDateTime"

lblTest.text = FormatDateTime(now,DateFormat.ShortDate)
 
I mean the main problem is that its a short date in sql but for some reason the asp conversion is tacking on the time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top