I want to convert datetime field to time in sql widget? I tried sql query but couldn't
could you help me out.
select cast("Datetime column" as time) as Ltime
Thank you Ravi :)
Hi Githiyon,
Give this a try with this one. You don't need any cast, just the receiving type should be Time. Outsystems will internally convert the DateTime field into Time by itself.
Glad it worked for you. It seems you marked the comment reply as Solution on the post instead of the actual solution :)
Hi,
I think you just need to make little changes in this, all other is okay..
SQL Server 2008:
SELECT cast(AttDate as time) [time]FROM yourtable
Earlier versions:
SELECT convert(char(5), AttDate, 108) [time]FROM yourtable
I tried this one in sql widget but it's not working
Wouldn't the CONVERT be wrong if Time is in the output since it produces a Text? I'd say just CONVERT(time, AttDate)?
"Not working" is not a good description of any problem. You need to describe what exactly you did and what result you got. Also, if possible, share a module so we can take a look.
First, you do not need to name columns, so the "as Ltime" part is not needed. Secondly, if you have a Time attribute in your output structure, OutSystems will convert the Date Time to Time automatically, so no need to cast inside the SQL. Thirdly, the cast seems valid, what exactly goes wrong with this?