Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fmardani
Constraint Violating Yak Guru
433 Posts |
Posted - 2005-08-03 : 03:32:04
|
| This sql produces the date as dd/mm/yy --> 01/01/2005CONVERT(CHAR(10),p.StartDate,103) as 'StartDate',BUT I would like to have 01/01/05 note 05 and not 2005Thanks |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-08-03 : 03:39:39
|
use char(8) instead of char (10) Duane. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-03 : 03:42:53
|
| >>use char(8) instead of char (10)That wont workWhere do you want to do this conversion?MadhivananFailing to plan is Planning to fail |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-08-03 : 03:50:36
|
| oops - my mistake,This should work.select REPLACE(convert(VARCHAR(10),p.StartDate, 103), '/' + CAST(YEAR(p.StartDate) / 100 AS VARCHAR(2)), '/')Duane. |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-08-03 : 04:17:48
|
| use style 3 instead of 103 (103 includes century - yyyy format)--------------------keeping it simple... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-03 : 04:21:31
|
| YesBut this kind of formating should be done in the presentation layer. If not supported there, then may be done in SQL queyMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|