How to preserve time stamp while copying a directory from Server B to Server A?

Experts,

Please help me out here.

How to preserve time stamp while copying a directory from Server B to Server A

Use the tar command:

# ServerA:
cd mydirectory
tar -cvf /tmp/my.tar .
scp /tmp/my.tar ServerB::/tmp/my.tar

#  ServerB:
mkdir /path/to/newdirectory
cd /path/to/newdirectory
tar xf /tmp/my.tar 

man scp :

What about rsync?

cd /home/myuser/mydata
rsync -av * username@otherserver:/home/myuser/mydata

If you already have public/private key authentication set up you won't need to type a password.