javascript implementation of strftime for Date object