Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What stored by the master?

904


How would we use distinct statement? What is its use?

1024


What are the different types of backups avaialabe in sql server 2005?

972


What stored by the model? : sql server database administration

903


Name three of the features managed by the surface area configuration tool? : sql server security

945


How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?

992


What does this statement do @@rowcount?

926


Where are sql server user names and passwords stored in sql server?

1018


What is the difference between commit and rollback?

877


Explain stored procedure?

987


What is indexed view? How to create it?

932


Explain what are page splits? : SQL Server Architecture

1006


What are the triggers in sql?

1021


Is it possible in sql table to have more than one foreign key?

980


What is thr feature of change data capture?

920