1507. Reformat Date Easy

@problem@discussion
#String



1/**
2 * [1507] Reformat Date
3 *
4 * Given a date string in the form Day Month Year, where:
5 * 
6 * 	Day is in the set {"1st", "2nd", "3rd", "4th", ..., "30th", "31st"}.
7 * 	Month is in the set {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}.
8 * 	Year is in the range [1900, 2100].
9 * 
10 * Convert the date string to the format YYYY-MM-DD, where:
11 * 
12 * 	YYYY denotes the 4 digit year.
13 * 	MM denotes the 2 digit month.
14 * 	DD denotes the 2 digit day.
15 * 
16 *  
17 * Example 1:
18 * 
19 * Input: date = "20th Oct 2052"
20 * Output: "2052-10-20"
21 * 
22 * Example 2:
23 * 
24 * Input: date = "6th Jun 1933"
25 * Output: "1933-06-06"
26 * 
27 * Example 3:
28 * 
29 * Input: date = "26th May 1960"
30 * Output: "1960-05-26"
31 * 
32 *  
33 * Constraints:
34 * 
35 * 	The given dates are guaranteed to be valid, so no error handling is necessary.
36 * 
37 */
38pub struct Solution {}
39
40// problem: https://leetcode.com/problems/reformat-date/
41// discuss: https://leetcode.com/problems/reformat-date/discuss/?currentPage=1&orderBy=most_votes&query=
42
43// submission codes start here
44
45impl Solution {
46    pub fn reformat_date(date: String) -> String {
47        String::new()
48    }
49}
50
51// submission codes end
52
53#[cfg(test)]
54mod tests {
55    use super::*;
56
57    #[test]
58    fn test_1507() {
59    }
60}
61


Back
© 2025 bowen.ge All Rights Reserved.