MacBook Pro crashes when charging when charger moves!
Lately my MacBook Pro has started crashing when it's charging. At first I thought it was completely random, but it seems to be when the bit that the connects the charger to the laptop moves, even if it's just the slightest bit. It crashes instantly, sometimes won't turn on for a while and when it finally does, the date and time have been reset to the 1st of January, 2001, 00:00 (this happens most of the time but not always).
After it crashes sometimes the charger light won't be on, indicating that it is not charging, and the laptop won't turn on until it is charging again, even if it does have battery power left. The laptop works fine when not charging.
So far I've just been trying to not use my laptop while it's charging and use it when it's not charging to prevent it from crashing mid-use, but it's becoming quite inconvenient. I'm a student so I would prefer to see if I can find a solution before going to the Apple Store as I don't want to spend money on fixing it if there's a way of doing it for free.
Here are some details about my laptop and the OS etc.:
OS X Yosemite version 10.10.2
Processor: 2,66 GHz Intel Core 2 Duo
Memory: 4 GB 1067 MHz DDR3
I would really appreciate some help because I have no idea how to fix this. I've checked everywhere online but can't find anything. Let me know if there's some information you need to help me identify and hopefully solve the problem.
Thanks!
MacBook Pro, OS X Yosemite (10.10.2)