Just a random one on how to get D/M from a datetime object -
Basically, from, for example, '2019-06-05 00:00:00.0000000' I need only the day and month as follows -
'5/6' (UK format and the zeros must be removed where present).
'2019-06-26 00:00:00.0000000' > '26/6'
'2017-12-03 00:00:00.0000000' > '3/12'
etc...
thanks
hi
i tried this
hope it helps .. i love feedback
declare @date1 date = '2019-06-26 00:00:00.0000000' -- > '26/6'
select ''+ cast(datepart(DD,@date1) as varchar)+'/'+cast(datepart(M,@date1) as varchar)+''
declare @dt datetime = getdate()
select convert(varchar(2),day(@dt)) + '/' + convert(varchar(2),month(@dt))
The CONCAT function takes care of converting to string for you - so you can do this:
Declare @dt datetime = getdate();
Select concat(day(@dt), '/', month(@dt));
Much simpler than convert yourself...
thanks all, all solutions good. Gone with the concat.