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 |
vk18
Posting Yak Master
146 Posts |
Posted - 2007-04-02 : 16:23:55
|
Hi Friends,How to remove slash from the date field. I have like '2/20/2007' . I want in the format of 2202007. How can we do this. I am using VB.NET/ASP.NET and SqlServer2000 appreciate your helpThx |
|
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-04-02 : 16:31:13
|
Give a tryFormat(CDate(strDate), "dddd MMM ddyyyy") |
|
|
reflex2dotnet
Yak Posting Veteran
99 Posts |
Posted - 2007-04-02 : 16:33:18
|
Please checkI think, using this format, you can change in any style as you wantRegards |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-04-02 : 17:28:49
|
I think that should beFormat(CDate(DateTime.Now), "MMddyyyy")Note, in your example you asked for 2/20/2007 to be formatted as 2202007, but the code I gave will give you 02202007 (the month will be zero padded), you should zero pad otherwise the values will be ambiguous, eg. is 1232007 12/3/2007 or 1/23/2007?If you really don't want the zero padding useFormat(CDate(DateTime.Now), "Mddyyyy") |
|
|
vk18
Posting Yak Master
146 Posts |
Posted - 2007-04-02 : 17:55:50
|
quote: Originally posted by snSQL I think that should beFormat(CDate(DateTime.Now), "MMddyyyy")Note, in your example you asked for 2/20/2007 to be formatted as 2202007, but the code I gave will give you 02202007 (the month will be zero padded), you should zero pad otherwise the values will be ambiguous, eg. is 1232007 12/3/2007 or 1/23/2007?If you really don't want the zero padding useHi, I tried this one i am getting an error message stating that"Over load resolution failed because no accessible format can be called wihtout a narrowing conversion". Any Idea..?ThxFormat(CDate(DateTime.Now), "Mddyyyy")
|
|
|
|
|
|
|
|