1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| carbon.SetTimezone(carbon.PRC).Now().ToDateTimeString() carbon.SetTimezone(carbon.Tokyo).Now().ToDateTimeString() carbon.SetTimezone(carbon.Tokyo).Now().SetTimezone(carbon.PRC).ToDateTimeString()
utc, _ := time.LoadLocation(carbon.UTC) carbon.SetLocation(utc).Now().ToDateTimeString() tokyo, _ := time.LoadLocation(carbon.Tokyo) carbon.SetLocation(tokyo).Now().ToDateTimeString()
carbon.Parse("2020-07-05 13:14:15").SetLocale("en").DiffForHumans() carbon.Parse("2020-07-05 13:14:15").SetLocale("zh-CN").DiffForHumans()
carbon.Parse("2020-01-01").SetDateTime(2019, 2, 2, 13, 14, 15).ToString() carbon.Parse("2020-01-01").SetDateTime(2019, 2, 31, 13, 14, 15).ToString()
carbon.Parse("2020-01-01").SetDateTimeMilli(2019, 2, 2, 13, 14, 15, 999).ToString() carbon.Parse("2020-01-01").SetDateTimeMilli(2019, 2, 31, 13, 14, 15, 999).ToString()
carbon.Parse("2020-01-01").SetDateTimeMicro(2019, 2, 2, 13, 14, 15, 999999).ToString() carbon.Parse("2020-01-01").SetDateTimeMicro(2019, 2, 31, 13, 14, 15, 999999).ToString()
carbon.Parse("2020-01-01").SetDateTimeNano(2019, 2, 2, 13, 14, 15, 999999999).ToString() carbon.Parse("2020-01-01").SetDateTimeNano(2019, 2, 31, 13, 14, 15, 999999999).ToString()
carbon.Parse("2020-01-01").SetDate(2019, 2, 2).ToString() carbon.Parse("2020-01-01").SetDate(2019, 2, 31).ToString()
carbon.Parse("2020-01-01").SetDateMilli(2019, 2, 2, 999).ToString() carbon.Parse("2020-01-01").SetDateMilli(2019, 2, 31, 999).ToString()
carbon.Parse("2020-01-01").SetDateMicro(2019, 2, 2, 999999).ToString() carbon.Parse("2020-01-01").SetDateMicro(2019, 2, 31, 999999).ToString()
carbon.Parse("2020-01-01").SetDateNano(2019, 2, 2, 999999999).ToString() carbon.Parse("2020-01-01").SetDateNano(2019, 2, 31, 999999999).ToString()
carbon.Parse("2020-01-01").SetTime(13, 14, 15).ToString() carbon.Parse("2020-01-01").SetTime(13, 14, 90).ToString()
carbon.Parse("2020-01-01").SetTimeMilli(13, 14, 15, 999).ToString() carbon.Parse("2020-01-01").SetTimeMilli(13, 14, 90, 999).ToString()
carbon.Parse("2020-01-01").SetTimeMicro(13, 14, 15, 999999).ToString() carbon.Parse("2020-01-01").SetTimeMicro(13, 14, 90, 999999).ToString()
carbon.Parse("2020-01-01").SetTimeNano(13, 14, 15, 999999999).ToString() carbon.Parse("2020-01-01").SetTimeNano(13, 14, 90, 999999999).ToString()
carbon.Parse("2020-02-29").SetYear(2021).ToDateString()
carbon.Parse("2020-02-29").SetYearNoOverflow(2021).ToDateString()
carbon.Parse("2020-01-31").SetMonth(2).ToDateString()
carbon.Parse("2020-01-31").SetMonthNoOverflow(2).ToDateString()
carbon.Parse("2020-08-02").SetWeekStartsAt(carbon.Monday).Week() carbon.Parse("2020-08-02").SetWeekStartsAt(carbon.Sunday).Week()
carbon.Parse("2019-08-05").SetDay(31).ToDateString() carbon.Parse("2020-02-01").SetDay(31).ToDateString()
carbon.Parse("2020-08-05 13:14:15").SetHour(10).ToDateTimeString() carbon.Parse("2020-08-05 13:14:15").SetHour(24).ToDateTimeString()
carbon.Parse("2020-08-05 13:14:15").SetMinute(10).ToDateTimeString() carbon.Parse("2020-08-05 13:14:15").SetMinute(60).ToDateTimeString()
carbon.Parse("2020-08-05 13:14:15").SetSecond(10).ToDateTimeString() carbon.Parse("2020-08-05 13:14:15").SetSecond(60).ToDateTimeString()
carbon.Parse("2020-08-05 13:14:15").SetMillisecond(100).Millisecond() carbon.Parse("2020-08-05 13:14:15").SetMillisecond(999).Millisecond()
carbon.Parse("2020-08-05 13:14:15").SetMicrosecond(100000).Microsecond() carbon.Parse("2020-08-05 13:14:15").SetMicrosecond(999999).Microsecond()
carbon.Parse("2020-08-05 13:14:15").SetNanosecond(100000000).Nanosecond() carbon.Parse("2020-08-05 13:14:15").SetNanosecond(999999999).Nanosecond()
|