|
|
sybperl-l Archive
Up Prev Next
From: Steve Allen <sallen at sybase dot com>
Subject: Has anybody any examples on datetime conversions and functions
Date: Mar 5 1998 12:55PM
Folks,
looking for examples and advise on datetime features to change spl to
sybperl.
eg.
if(select datepart(weekday,@startdate))>=2
begin /* find date of monday for this week */
select @startdate =
dateadd(day,-(datepart(weekday,@startdate) - 2),@startdate)
end
else
begin /* sunday (day 1) should show week starting from following
day */
select @startdate = dateadd(day,+1,@startdate)
end
/* force time part of date to be 12:00AM */
select @chardate = convert(char(8),@startdate,1)
select @startdate = convert(datetime,@chardate)
/* set finishdate at 12:00 AM in 7 days */
select @finishdate = dateadd(day,+6,@startdate)
any help would be appreciated.
|