scm0sml
asked on
Changing the time value of a sql datetime
Hi How can I set just the time value of a datetime:
for example
DECLARE @ENDDATE SMALLDATETIME
SET @ENDDATE = GETDATE()
If i wanted to then amend the time value of @ENDDATE, how would I do this?
for example
DECLARE @ENDDATE SMALLDATETIME
SET @ENDDATE = GETDATE()
If i wanted to then amend the time value of @ENDDATE, how would I do this?
select CONVERT(varchar,getdate(), 108)
make sure that you store that value in a Varchar column
declare @Time = varchar(10)
select @Time = CONVERT(varchar,getdate(), 108)
declare @Time = varchar(10)
select @Time = CONVERT(varchar,getdate(),
ASKER
say i have
SET @TESTDATE = GETDATE()
That will give me the date and time for now.
But say I wanted to set the time value of @TESTTIME to 09:30 for example.
How can i do this?
SET @TESTDATE = GETDATE()
That will give me the date and time for now.
But say I wanted to set the time value of @TESTTIME to 09:30 for example.
How can i do this?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.