| Author |
Topic |
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2005-07-25 : 10:20:00
|
| When i write that code select getdate()2005-07-25 17:18:28.210but i want it like25-07-2005 17:18:28.210is there any code to format or conver getdate function??likeselect getdate(dd.mm.yyyy) :)helppMCP (70-229) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-25 : 10:24:33
|
| Do this in your presentation layerWhat is your Front end application?MadhivananFailing to plan is Planning to fail |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-07-25 : 10:25:32
|
| Select Convert(Varchar,Getdate(),103)for other formats you Search for Convert on BOL...Complicated things can be done by simple thinking |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-07-25 : 10:25:42
|
look up convert function in BOL = Books OnLine = sql server help.Go with the flow & have fun! Else fight the flow |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-07-25 : 10:26:19
|
by 10 seconds Go with the flow & have fun! Else fight the flow |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-25 : 10:27:44
|
>>Select Convert(Varchar,Getdate(),103)That should be 104 MadhivananFailing to plan is Planning to fail |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-07-25 : 10:32:14
|
Right ... |
 |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2005-07-25 : 10:44:52
|
| thx guys :) MCP (70-229) |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2005-07-25 : 11:38:52
|
| Sorry, mad had it right in the first response. Quit fiddling with dates on SQL SERVER, and let the presentation layer do it!*need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected) |
 |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2005-07-26 : 15:04:58
|
| donatwork what are u triing to say?presentation layer cant do it. it must be on sql. and i solved problem. user your clue on other worksMCP (70-229) |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-07-26 : 15:09:26
|
| Your presentation layer cannot format date values? What are you using to present your data, notepad ?- Jeff |
 |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2005-07-26 : 15:13:33
|
| arggggg.no i have to make calculations on sql to fill datagridand i dont want to use vs.net to do it.i want to do other alternatesssss and fixed it.as you have ages , i have projects more than it.MCP (70-229) |
 |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2005-07-26 : 15:48:31
|
quote: Originally posted by jsmith8858 Your presentation layer cannot format date values? What are you using to present your data, notepad ?- Jeff
Why would you post something like this? Why insult the guy for no reason?-ec |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-07-26 : 15:55:37
|
quote: Originally posted by eyechart
quote: Originally posted by jsmith8858 Your presentation layer cannot format date values? What are you using to present your data, notepad ?- Jeff
Why would you post something like this? Why insult the guy for no reason?-ec
Of all the questionable posts over the years here at sqlteam, you pick my joke about notepad as an "insult"?- Jeff |
 |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2005-07-26 : 16:00:30
|
| what a nice jokeMS BLESS US |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-07-26 : 16:11:59
|
| You first said you CAN'T do your formatting at the client; but now we have determined that you simply don't want to. Keep in mind that instead of returning dates to your datagrid, you are now returning strings formatted to look like dates. So if you need to sort or compare your dates using the features of DataGrids, they will not work properly unless you first convert the values back to the original date values. This is a big reason why, in SQL Server, you should just return VALUES back to the client and let the client do the formatting, and let your datagrids contain the values and do the formatting for you. DataGrid's have full formatting capabilities to format dates any way you need, and it is much more flexible than using CONVERT() in T-SQL. T-SQL is not a language designed for data formatting, and as such your database layer should not do formatting. It is almost always easier, more efficient, and more flexible to have the client do this work.Often, people say they don't have time to do it right, they just need to get it done. And it invariably ends up taking longer and being a lot more work in the long run doing things the "quick" way and not taking the time use best practices.edit: Though I will add that it is a little complicated to format columns on a windows forms DataGrid; it is much easier in ASP.NET. This link http://support.microsoft.com/default.aspx?scid=KB;EN-US;318581 has some info for you.- Jeff |
 |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2005-07-26 : 16:21:50
|
| SET DATEFORMAT dmydatetime column formating is looks okay now. and works in datediff(day,satrtdate,enddate)now everyting is okay :)just be ok.MS BLESS US |
 |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2005-07-26 : 16:55:17
|
| Jeff,I prefer to answer people's questions. It is fine to point out that there might be other, better methods to accomplish something, but it is more important to answer the question asked.Obviously, bil is not a native english speaker. Do you really expect him to understand your joke?-ec |
 |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2005-07-26 : 17:06:46
|
| :) thx eyechart my native lang is turkishmy english is not very well :) sorryMS BLESS US |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-07-26 : 18:05:36
|
quote: Originally posted by eyechart Jeff,I prefer to answer people's questions. It is fine to point out that there might be other, better methods to accomplish something, but it is more important to answer the question asked.Obviously, bil is not a native english speaker. Do you really expect him to understand your joke?-ec
I am sorry to offend you as well. I was only trying to insult him alone, and not others in the forum, with my nasty message. He said his presentation layer could not do the formatting. I doubted that and implied that just about the only "presentation" tool that cannot format dates for you would be something like notepad. And guess what?My mean, horrible insult actually resulted in a reply in which he indicated what the actual tool is. And then, somehow, we both got past the nasty name calling that I instigated, and I was able to use the information from his reply to somehow actually provide an answer, a link, and some more information for him, despite my honest attempts to simply cause trouble and not help in any way.- Jeff |
 |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2005-07-26 : 18:09:42
|
| :) lol stopforgot my questions :)) these messegaes are off topicMS BLESS US |
 |
|
|
Next Page
|