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 |
|
aoriju
Posting Yak Master
156 Posts |
Posted - 2011-09-15 : 05:30:30
|
| Hi All,I want to generate getdate() as following format 15-Sep-2011can u guys pls help me ASAP |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-15 : 05:49:38
|
| try to do it at front end as its a presentation issue.or else make use of CONVERT------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Villanuev
Constraint Violating Yak Guru
478 Posts |
Posted - 2011-09-15 : 05:49:45
|
| Just try this one.SELECT convert(varchar,getdate(),13) |
 |
|
|
aoriju
Posting Yak Master
156 Posts |
Posted - 2011-09-15 : 06:02:05
|
| Villanuev This "SELECT convert(varchar,getdate(),13)" not staisfied my requirementI got it through this way,SELECT REPLACE(CONVERT(VARCHAR(11), GETDATE(),106),' ','-') AS DateFormatAnyway thanks for your reply |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-15 : 07:41:03
|
quote: Originally posted by aoriju Villanuev This "SELECT convert(varchar,getdate(),13)" not staisfied my requirementI got it through this way,SELECT REPLACE(CONVERT(VARCHAR(11), GETDATE(),106),' ','-') AS DateFormatAnyway thanks for your reply
keep in mind that you're making date manipulations difficult for you by changing its native data type. All this just for display format sake, which can be very easily achieved in any front end programming language using format functions.So unless there was no other way out, what you're doing here is not a recommended approach------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|