'Create the session IDs based on time-difference in events for individual users

I need to create the session Ids for individual users based on the time difference in the events triggered by them. If the time difference between two events in more than 60 minutes then new session id for a particular users

User Event_Time Session Id
A 2016-01-01 00:00:15 1
A 2016-01-01 00:00:17 1
A 2016-01-01 00:00:27 1
B 2016-01-01 00:00:27 1
A 2016-01-01 04:01:59 2
B 2016-01-01 22:00:27 2


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source