Last post Dec 12, 2011 05:25 AM by dino Grievous
Dec 07, 2011 06:53 AM|Ashraf007|LINK
I want to show to user the notification date and time just like this forum does .... 1 minutes ago , 1 hours ago , 1 days ago and finally the exact date and time ....
Plz help me in this ....
Dec 07, 2011 07:16 AM|kedarrkulkarni|LINK
you would want to show notification about some activity.... like this forum shows last post .. ago
you would have to capture date and time of that activity... for every post, capture post submit time...
when u want to display the time difference.... in database u can calculate difference in current time and last post time...
suppose u have simillar data for forum posts... u can use quesry like
select DTEEDIFF(second, post_submit_time, GETDATE()), DTEEDIFF(minute, post_submit_time, GETDATE()), DTEEDIFF(hour, post_submit_time, GETDATE()), DTEEDIFF(day, post_submit_time, GETDATE())
this will give u differnece in date value of post_submit_time column and current date.... second, minute etc in this query are datepart keywords... and gives u difference in seconds or minutes etc.
upon this, u can build a logic to get most relevant datepart value... like if difference is more than 60 seconds then use minute value etc.
hope this helps...
Dec 07, 2011 07:31 AM|mudassarkhan|LINK
Dec 07, 2011 08:30 AM|Ashraf007|LINK
I have stored date and time in 1 column .... Dat is i have used datetime datatype. In sql 2008 there is seprate date and time datatype, so let me know how o store it.
1. I need to know how to store date and time using C# ... That is datetime.now.tostring(); Plz give example to store date and time in seprate column using C#.
2. Also i have a problem here, users are from different part of the world. So, how to show them their exact date and time... Plz suggest ...
Dec 08, 2011 12:16 PM|mudassarkhan|LINK
the date displayed to all users will be same irrespective of their location because C# and SQL Server both use current date time of server.
Dec 10, 2011 02:17 PM|Ashraf007|LINK
If i need to get user date and time mean what i have to do ?
Dec 12, 2011 05:25 AM|dino Grievous|LINK
You can write a function like this:
static void StoreLastActionTime()
//store them to DB
Then put them to you method like button1_click method.
This will get user location date. DateTime Class always be used to handle this problem.
For more information: