add new_with_out_err

This commit is contained in:
2020-06-22 01:49:17 +08:00
parent 6c7ea70a41
commit d6fb04455c

View File

@@ -91,6 +91,11 @@ impl SimpleDateFormat {
fmt(f)
}
/// Create format from string with out error
pub fn new_with_out_err(f: &str) -> SimpleDateFormat {
Self::new(f).unwrap_or_else(|_| Self{ parts: vec![] })
}
// Format date
/// ```ignore
/// let t = Utc.timestamp_millis(1590816448678);