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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling parts of a date from a SQL table using VB

Status
Not open for further replies.

JoeCool32

Programmer
Sep 26, 2002
50
US
I've got two date fields in a SQL table, dateStarted and dateEnded. I'm trying to pull the day, month and year info from them into separate ASP textboxes (i.e. txtMth, txtDay, txtYear, txtMth2, txtDay2, txtYear2) using VB. Assuming I've already opened the SQL connection how would I proceed to populate the textboxes w/ the days, months, and years separately? JJ [peace]

"Ignorance and prejudice and fear walk hand in hand" - Witch Hunt, by Rush
 
Get the data into a date type variable then simply use the
.day
.month
.year
to pull out the part of the date that you want. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
I'll see how to work that in. Thanks. JJ [peace]

"Ignorance and prejudice and fear walk hand in hand" - Witch Hunt, by Rush
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top