formatted date function and test working