| Author |
Topic |
|
roop
Starting Member
9 Posts |
Posted - 2007-09-12 : 05:41:22
|
| hi,i have a problem.i m inserting data in "dd/mm/yyyy" string format and i want to ocnvert in "dd mon yyyy" format.for eg-- i m entering 30/11/2007" and i wnat in this format "30 Nov 2007"if any body knows please help me.thanx... |
|
|
roop
Starting Member
9 Posts |
Posted - 2007-09-12 : 05:47:02
|
| plssssany body....provide me soln..... |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2007-09-12 : 05:47:53
|
| look up convert...but you don't really have to worry about how the date is stored, you just only need to know how your sql server stores it so you can format it any way you like when retrieving--------------------keeping it simple... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-12 : 05:48:59
|
| 1 Always use proper DATETIME datatype to store dates2 When adding dates express them in YYYYMMDD format2 Let your front end do formationMadhivananFailing to plan is Planning to fail |
 |
|
|
roop
Starting Member
9 Posts |
Posted - 2007-09-12 : 05:50:01
|
| i have one soln like....select CONVERT(varchar, CONVERT(datetime, '30/11/2006'), 106)but i want ot give input as 11/30/2006..... |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2007-09-12 : 05:55:00
|
if you pass that value in a datetime variabledoes it accept the date value?are you worried that the date is misinterpreted?store the value and retrieve it so you can verifythe key is test test test... no matter what others say,test test testquote: Originally posted by roop i have one soln like....select CONVERT(varchar, CONVERT(datetime, '30/11/2006'), 106)but i want ot give input as 11/30/2006.....
--------------------keeping it simple... |
 |
|
|
roop
Starting Member
9 Posts |
Posted - 2007-09-12 : 06:04:32
|
| actually there is some boundations thats why i m giving in dd/mm/yyyy format...so if any one has something pls tell me.... |
 |
|
|
roop
Starting Member
9 Posts |
Posted - 2007-09-12 : 06:13:29
|
| nobody can tell?.....pls |
 |
|
|
roop
Starting Member
9 Posts |
Posted - 2007-09-12 : 07:58:00
|
| if any body can saolve my problem....? my problem is thati m inserting data in "dd/mm/yyyy" string format and i want to ocnvert in "dd mon yyyy" format.for eg-- i m entering 30/11/2007" and i wnat in this format "30 Nov 2007"pls...any one......... |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2007-09-12 : 08:03:36
|
| Maybe this will clarify things for you about how datetime is stored. It's up to you when you display the data to use the convert function to display it in the proper format. It's not stored as a string unless you store a datetime as a string in a char type column.http://www.sql-server-performance.com/articles/dev/datetime_datatype_p1.aspxPS: If anyone is interested in a sql position in Connecticut with excellent pay send me your resume at ValterBorges@msn.com |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-09-12 : 08:37:09
|
quote: Originally posted by roop if any body can saolve my problem....? my problem is thati m inserting data in "dd/mm/yyyy" string format and i want to ocnvert in "dd mon yyyy" format.for eg-- i m entering 30/11/2007" and i wnat in this format "30 Nov 2007"pls...any one.........
DO NOT WORRY ABOUT FORMATTING in sql server. Where are you ultimately displaying these dates? In a report, on a web page, in Excel, in an application? THAT is where you do all formatting. Just return the date in SQL, and let your front end handle making it look pretty. That's the easiest and most correct way to handle this.See: http://weblogs.sqlteam.com/jeffs/archive/2007/04/13/60175.aspx- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-12 : 08:40:45
|
Handling dates seem to be a big problem to all newbies MadhivananFailing to plan is Planning to fail |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-09-12 : 08:52:49
|
| It's amazing, isn't it? How much time and effort they spend doing something that they simply don't need to.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
|