fixed mysql date time error

added if check for mysql