Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
Old 06-18-2008, 01:49 AM separate date
Nazi370's Avatar
Skilled Talker

Posts: 70
Name: Nazirul
Trades: 0
hi all..

in my database, i have created date with format "15 June 2008"

how do i output it so i only take 15.. is it possible?

thanks
Nazi370 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-18-2008, 03:35 AM Re: separate date
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,515
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
What database?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-18-2008, 03:55 AM Re: separate date
Nazi370's Avatar
Skilled Talker

Posts: 70
Name: Nazirul
Trades: 0
sql server 2000...

the format for the database is Varchar and not Date

Dim myDate As String = Trim(ddlStartDay.SelectedItem.Value) & " " & Trim(ddlStartMonth.SelectedItem.Value) & " " & Trim(ddlStartYear.SelectedItem.Value)

so in my database it will appear like '15 June 2008' and so on when retrieve it.
thanks
Nazi370 is offline
Reply With Quote
View Public Profile
 
Old 06-18-2008, 03:03 PM Re: separate date
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Select DatePart(dd, Cast('15 June 2008' as varChar))
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-19-2008, 04:21 AM Re: separate date
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,515
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
It's much simpler when you store dates as dates not strings.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-19-2008, 05:21 AM Re: separate date
Nazi370's Avatar
Skilled Talker

Posts: 70
Name: Nazirul
Trades: 0
since i have 3 dropdownlist boxes... it is much easier for user to select dd/month/year rather than typing it..


what if 15 June 2008 not specific?

Select DatePart(dd, Cast('unknown value' as varChar))
Nazi370 is offline
Reply With Quote
View Public Profile
 
Old 06-22-2008, 07:24 AM Re: separate date
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,515
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Select DatePart(dd, Cast(ColumnName as varChar))

Quote:
since i have 3 dropdownlist boxes... it is much easier for user to select dd/month/year rather than typing it
Assuming you concatenate the three values into a single string on insert, it's just as easy to convert to a date at the same time.
AND if your column is already a date type the conversion should be done automatically by the server on inserting.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to separate date
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25174 seconds with 12 queries