Sweets287 Posted September 30, 2013 Share Posted September 30, 2013 Hi All!! I have some php script in a program I use and I'm struggling to change it. It works fine Getting the personId for any details less than 1 day old, but I want to change it to any details less than 1 hour old. I've tried changing DATEADD(d,-1,getdate()) to DATEADD(h,-1,getdate()) and googling other things but still stumped Any Ideas? select PersonId dReceievedDate = cast(YEAR(dReceievedDate) as varchar(4))+'-'+ RIGHT(CAST(MONTH(dReceievedDate) as varchar(2)),2)+'-'+ RIGHT(CAST(DAY(dReceievedDate) as varchar(2)),2) from peopletbl where dReceievedDate >DATEADD(d,-1,getdate()) order by PersonId DESC Quote Link to comment https://forums.phpfreaks.com/topic/282571-php-date-and-hours/ Share on other sites More sharing options...
kicken Posted September 30, 2013 Share Posted September 30, 2013 DATEADD(HOUR, -1, GETDATE()) 'H' is not a valid date part identifier.See: http://technet.microsoft.com/en-us/library/ms186819.aspx Quote Link to comment https://forums.phpfreaks.com/topic/282571-php-date-and-hours/#findComment-1451900 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.