-
Notifications
You must be signed in to change notification settings - Fork 3
Date Path Format for Stored Uploaded Files
HaierKeys edited this page Mar 15, 2025
·
1 revision
In some application scenarios, we need to save uploaded files to specific date paths for easy management and querying.
The time format is based on the common Go language practice of time.Time.Format(layout string). If you know Go, you can ignore the following content.
The fixed reference time 2006-01-02 15:04:05
defines the format, with the numerical sequence corresponding to:
-
2006
→ Year -
01
→ Month -
02
→ Day -
15
→ Hour (24-hour format) -
04
→ Minute -
05
→ Second -
.000
→ Milliseconds (or.999
for microseconds)
Format Description | Format String | Actual Generated Date Path |
---|---|---|
Store by Year/Month/Day | "2006/01/02/" |
2025/08/15/ |
Filename with Timestamp | "20060102_150405" |
20250815_143045 |
Time with Milliseconds | "2006-01-02_15-04-05.000" |
2025-08-15_14-30-45.123 |
12-Hour Format with AM/PM | "2006-01-02_03-04-05PM" |
2025-08-15_02-30-45PM |