If you want to look back further than the few weeks that last
will show these entries are stored for much longer in the ASL database. To view logins use this command, substituting the name you are searching for, or leave off the | grep insert_username_here
to see everyone.
syslog -F raw -k Facility com.apple.system.lastlog | grep insert_username_here
To see logouts use:
syslog -F raw -k Facility com.apple.system.utmpx | grep insert_username_here
To view this more cleanly you could use this, which does not show logins via terminal and will show just the epoch times. You must grep for a username or else the data is meaningless:
syslog -F raw -k Facility com.apple.system.lastlog | grep insert_username_here | grep -v tty | awk '{ print $2 }' | sed -e 's/]//g'
The date is displayed as the epoch time. You can convert that to normal time with http://www.epochconverter.com/