Author |
Topic |
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-07-18 : 04:14:53
|
how can i get datepart only from date time?? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-18 : 04:29:07
|
SELECT DATEADD(DAY, DATEDIFF(DAY, '19000101', getdate()), '19000101') E 12°55'05.25"N 56°04'39.16" |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-07-18 : 04:51:25
|
may i know which is my field name?thanks.quote: Originally posted by Peso SELECT DATEADD(DAY, DATEDIFF(DAY, '19000101', getdate()), '19000101') E 12°55'05.25"N 56°04'39.16"
|
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-18 : 04:55:16
|
SELECT datecol,DATEADD(DAY, DATEDIFF(DAY, '19000101', datecol), '19000101') from your_tableMadhivananFailing to plan is Planning to fail |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-07-18 : 05:06:30
|
Still get date+time,Actually datetime column in my table contains datepart only since save datepart only.But when i retrieve i got date+time.quote: Originally posted by madhivanan SELECT datecol,DATEADD(DAY, DATEDIFF(DAY, '19000101', datecol), '19000101') from your_tableMadhivananFailing to plan is Planning to fail
|
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-18 : 05:10:23
|
quote: Originally posted by kwikwisi Still get date+time,Actually datetime column in my table contains datepart only since save datepart only.But when i retrieve i got date+time.quote: Originally posted by madhivanan SELECT datecol,DATEADD(DAY, DATEDIFF(DAY, '19000101', datecol), '19000101') from your_tableMadhivananFailing to plan is Planning to fail
Then where do you want to show data?MadhivananFailing to plan is Planning to fail |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-07-18 : 05:13:13
|
shown in grid(template column).if it's bound col, i can cast in Itemdatabound_Event .but i must use template col coz this field can be updated.quote: Originally posted by madhivanan
quote: Originally posted by kwikwisi Still get date+time,Actually datetime column in my table contains datepart only since save datepart only.But when i retrieve i got date+time.quote: Originally posted by madhivanan SELECT datecol,DATEADD(DAY, DATEDIFF(DAY, '19000101', datecol), '19000101') from your_tableMadhivananFailing to plan is Planning to fail
Then where do you want to show data?MadhivananFailing to plan is Planning to fail
|
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-18 : 05:15:39
|
Omitting time part is a presentation issue. Do that in your grid. E 12°55'05.25"N 56°04'39.16" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-18 : 05:15:56
|
Cant you use format function in the front end application?MadhivananFailing to plan is Planning to fail |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-07-18 : 05:19:22
|
ya,i can cast if it's bound col .problem is it's template col.quote: Originally posted by Peso Omitting time part is a presentation issue. Do that in your grid. E 12°55'05.25"N 56°04'39.16"
|
 |
|
VGuyz
Posting Yak Master
121 Posts |
Posted - 2008-07-21 : 06:26:09
|
HI.,Chk this ..select convert(varchar(15),getdate(),110) as datepart |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-21 : 06:29:03
|
quote: Originally posted by VGuyz HI.,Chk this ..select convert(varchar(15),getdate(),110) as datepart
That would become varchar so that cant be used for any datetime related calculationsMadhivananFailing to plan is Planning to fail |
 |
|
|