SELECT TOP 5 CreationDate ,CAST(CreationDate as DateTime)...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Anime and Manga

Q&A for anime and manga fans

SELECT TOP 5 CreationDate
   ,CAST(CreationDate as DateTime) as CreatDatedatetime
   ,DATEADD(M, -3, GETDATE()) as CurrenDate3MonthAgo
   ,creationDate+2*365/12  as CreationDatePlus2Months
   ,datediff(MONTH,creationDate, getDate()) as PostAgeInMonths
   ,CAST(CreationDate as Date) as CreationDateAsDate
   ,CAST(CreationDate as Time) as CreationDateTime
   ,CAST(CreationDate as Char) as CreationDateAsVarchar
   ,CONVERT(VarChar, CreationDate, 104) as CreationDateLVFormat
   ,CONVERT(VarChar, GetDate(), 104) as todayDateLVFormat
   ,MONTH(CreationDate) as CreateDateMonth
   ,Year(CreationDate) as CreateDateYear
   ,CASE 
       WHEN Year(CreationDate)>=2021 THEN 'New' 
       ELSE 'Old' 
    END as OldOrNewPostThisYear
   ,CASE Year(CreationDate)
       WHEN 2021 THEN 'New' 
       WHEN 2020 THEN 'Old' 
       ELSE 'Very Old' 
    END as OldOrNewPostThisYear
FROM Posts
WHERE CreationDate>=CAST('2021-06-01' AS DATE)
AND CreationDate<=CAST('2021-06-05' AS DATE)

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results