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

How do you make a trace?

1077


How to generate random numbers with the rand() function in ms sql server?

1230


Explain what is “asynchronous” communication in sql server service broker?

962


What is the use of custom fields in report?

1043


What is difference between createstatement and preparedstatement?

1176


what are candidate key, alternate key and composite key? : Sql server database administration

966


What are the different ways you can create databases in sql server?

1157


What are some of the pros and cons of not dropping the sql server builtinadministrators group? : sql server security

1033


How to view existing indexes on an given table using sp_help?

1210


What is isnull() operator?

1092


How to use "begin ... End" statement structures in ms sql server?

1121


How to list all user defined functions in the current database?

1121


List out some of the requirements to set up a sql server failover cluster?

1083


Can I disable or restrict ssrs export formats (rendering formats)?

155


What is tempdb in sql server?

1031