Auto Update Copyright Year using JavaScript

Copy the script code below and paste it into your website where you want your copyright notice to appear.

<script language=”javascript” type=”text/javascript”>

document.write(‘©’ );

document.write(‘YourSiteName.com’);

document.write(new Date().getFullYear());

</script>

Happy Coding 🙂

Advertisements

Get a table with (months + year) between two dates using MSSQL

DECLARE @start DATE = GETDATE()
DECLARE @nth INT = 3
DECLARE @end DATE = DATEADD(MONTH, @nth, GETDATE());

WITH cte
AS (
SELECT dt = DATEADD(DAY, – (DAY(@start) – 1), @start)

UNION ALL

SELECT DATEADD(MONTH, 1, dt)
FROM cte
WHERE dt < DATEADD(DAY, – (DAY(@end) – 1), @end)
)
SELECT CONVERT(CHAR(4), dt, 100) + CONVERT(CHAR(4), dt, 120)
FROM cte

Happy Coding 🙂