sql server has its default date format in da form "yy-mm-dd"
its possible to convert da current date format of sql
server to desired format. Now my question is dat how to get
da previous and comin days date in my desired format??
Answer Posted / ritesh parkhi
Yes you can convert it through using
"select
convert(varchar(20),strDate,[1,2,3,4,5,6,101,102,103,104,105,106])"
diffrent diffrent code is present here you can try to use
all like
"select convert(varchar(20),strDate,101)"
where strDate is your date like "12/05/2008" or date from
database.Try it it will solve your problem.
Now second problem to get privious and cming date
"select dateadd(dd,2,strDate)"
i used here dateadd function where dd is used for Day.you
can use MM for month and YYYY fro year also.After that I
gave 2,it is the number to increment in days ,month and
year.and in last i gave strDate
Now i want to get date before 2 days so i will right
"select dateadd(dd,-2,strdate)"
Hopw you will get your answers
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What stored by the master?
How would we use distinct statement? What is its use?
What are the different types of backups avaialabe in sql server 2005?
What stored by the model? : sql server database administration
Name three of the features managed by the surface area configuration tool? : sql server security
How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
What does this statement do @@rowcount?
Where are sql server user names and passwords stored in sql server?
What is the difference between commit and rollback?
Explain stored procedure?
What is indexed view? How to create it?
Explain what are page splits? : SQL Server Architecture
What are the triggers in sql?
Is it possible in sql table to have more than one foreign key?
What is thr feature of change data capture?