Added test and code for portdate function.