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 |
|
Makkaramestari
Starting Member
8 Posts |
Posted - 2006-02-16 : 03:32:19
|
| Hi!I want to get current date and subtract 14 days from that date and return result as int in yyyymmdd-format.How should I do that?Thanks in advance, Makkaramestari |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2006-02-16 : 03:36:25
|
| SELECT CONVERT(CHAR(8), DATEADD(day, -14, CURRENT_TIMESTAMP), 112)Mark |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-16 : 04:15:26
|
| Select DateAdd(day,Datediff(day,0,getdate()),-14) To format it, use front end application (if you use it). Otherwsie useSelect convert(varchar,DateAdd(day,Datediff(day,0,getdate()),-14),112) as ConvertedDateMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|