code to manage dates between stock market and text