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 |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2006-01-17 : 11:45:16
|
| How to convert the date to mm/dd/yyyy or mm/dd/yy in the select statement:CONVERT(varchar(10), TAB_ccsNetSU.PDReceivedDate, 101) AS PDReceivedDateon the vb front end i use the if condition as follows:If Not IsDate("01/17/06") ThenThank you very much for the information. |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-01-17 : 12:18:06
|
| Check Books On Line - convert Function in T-SQLThe constant is 101 for mm/dd/yyyyfor mm/dd/yy the constant is 1Check : Select getdate() Select convert(varchar, getdate(), 101) Select convert(varchar, getdate(), 1) in Query Analyzer |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-01-17 : 14:03:13
|
Why not transfer it as a "native" DateType and then compare it likewise in VB?That prevents any country-specific formatting issues getting in your way.Converting it to a text string, and back again, and messing around with trying ton get the formatting synchronised between your application and SQL Server is going to make you old before your time!Presumably something like:Dim myDate As DatemyDate = ... Some Date ...If MyRecordSet("PDReceivedDate").Value = myDate Then ... some action ...Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-01-18 : 01:06:04
|
| As Kristen said, dont use Format function when you compare dates. Use it when you display themMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|