I'm working in project for by PHP and SQL Server.
The owner want from me design page show only users who register in same day
i.e., if today 11-3-2011 i want show only all users who register in 11-3-2011
The table is:
id username date
1 john 11\3\2011
2 sara 11\3\2011
3 john 5\1\2011
4 kreem 1\2\2011
i make it by mysql
where DATE_ADD( items.created_date, INTERVAL 1 DAY ) > NOW()
this cable of code show data which only insert in same day thats mean if today 10-4-2011 it will show only data which insert in 10-4-2011 if i today 15-4-2011 and im dose not insert any thing it will not show any thing, how i can build code like this in sql server? hope to be my question clear and understand
select id, userName
from YourTable
where CAST(date AS DATE) = CAST(GETDATE() AS DATE)
Function GETDATE() returns the current date and time.
CAST(column as TYPE) will threat DateTime as just Date to omit differences in Time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With