What is Ex-date and Record date?

Ex-date and record date both are clubbed together which a company uses to identify the long term shareholders and provide the bonus. 

Click here to watch: 

[Part 1] https://www.youtube.com/watch?v=D7y_zV134rI

[Part 2] https://www.youtube.com/watch?v=UR5jHRhPELA