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 |
seeker62
Starting Member
40 Posts |
Posted - 2013-01-30 : 15:23:21
|
I have this piece of code in a sp:SET WeekOf = RTRIM(Left(DATEADD(dd, DATEDIFF(dd,0,sd.LoadDAte)/7*7,0),10))I am trying to just have the mm/dd/yyy and not hh:mm:ss in my smalldatetime field in the table. Is there a way to do this? |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-01-30 : 15:24:50
|
CAST(<DateTimeValue> AS DATE) |
|
|
seeker62
Starting Member
40 Posts |
Posted - 2013-01-30 : 15:58:29
|
This puts mm/dd/yyyy 00:00:00 which then comes into my spreadsheet as mm/dd/yyyy 12:00:00 AM I have tried formating the cell in the spreadsheet but it is developed by code and evidently the control i am using does not have a date for a format of a cell. It has datetime. I suppose i could change datatype in table to varchar |
|
|
seeker62
Starting Member
40 Posts |
Posted - 2013-01-30 : 16:05:51
|
Found a workaroundDateTime dtWeekOf = DateTime.Parse(dr["WeekOf"].ToString()); row.Cells.Add(dtWeekOf.ToString("s"), DataType.DateTime, "DateFormat");Thanks. |
|
|
|
|
|