For singleplayer you can.
The number of days you play a world is shown on the screen when you press F3.
Take that number and multiply by 1/3 and that is the number of hours you've played that world. Do this for all you single player worlds and add them up and that is your total time played.
As for multiplayer there no way to check for sure.
Singleplayer is possible, multiplayer is not.
Hope this helped!