Click here to Skip to main content
13,343,419 members (54,691 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to get last login date of user
Posted 1-Oct-12 20:29pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to maintain a field in your database (probably in login details table) - lasLogin. Everytime user logs in, you will need to populate this field such that, on next login you can pick tha last login datetime and show to user.
Jasbeer Singh 2-Oct-12 1:46am
and should i delete that date after showing it once . or what to do..
Sandeep Mewara 2-Oct-12 2:03am
It's a field in Database. Keep it as is always. Thus, after 100th login, user will have all 100 rows for last login filled up.
Jasbeer Singh 2-Oct-12 2:16am
can u please illustrate this, how to do it. in coding where to insert it and how to retrieve last one only
Sandeep Mewara 2-Oct-12 2:51am
Please don't expect exact code.

Simpler way, steps:
1. Define a field in database in username, password contained table as 'LastLoginDate'
2. Whenever someone gives his username, password - if valid, get the value in field first
3. Now, update the lastloginfield value with current datetime
4. Next time, login, repeat 2 & 3


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100