SELECT TOP 3 CreationDate ,CAST(CreationDate AS datetime)...


Please login or register to vote for this query.

(click on this box to dismiss)

Bicycles Meta

Q&A about the site for people who build and repair bicycles, people who train cycling, or commute on bicycles

   ,CAST(CreationDate AS datetime) as CreateDatedatetime
   ,GETDATE() as CurrentDate
   ,DATEADD(M, -3, GETDATE()) as CurrentDate3MonthAgo
   ,creationDate+2*366/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
       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

Switch to main site
loading Hold tight while we fetch your results