Heure
Traduction Bêta Non Officielle
Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →
Description
Affiche l'horodatage actuel.
Exemple de configuration
- json
- yaml
- toml
{
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"options": {
"time_format": "15:04:05"
}
}
type: time
style: plain
foreground: "#007ACC"
options:
time_format: 15:04:05
type = "time"
style = "plain"
foreground = "#007ACC"
[options]
time_format = "15:04:05"
Options
| Name | Type | Default | Description |
|---|---|---|---|
time_format | string | 15:04:05 | Format to use |
Modèle (info)
modèle par défaut
{{ .CurrentDate | date .Format }}
Propriétés
| Name | Type | Description |
|---|---|---|
.Format | string | The time format (set via time_format) |
.CurrentDate | time | The time to display (testing purpose) |
Syntaxe
Formats
Suit le standard de date/heure de Go :
| DateTime | Format |
|---|---|
| Year | 06, 2006 |
| Month | 01, 1, Jan, January |
| Day | 02, 2, _2 (width two, right justified) |
| Weekday | Mon, Monday |
| Hours | 03, 3, 15 |
| Minutes | 04, 4 |
| Seconds | 05, 5 |
| ms μs ns | .000, .000000, .000000000 |
| ms μs ns (trailing zeros removed) | .999, .999999, .999999999 |
| am/pm | PM, pm |
| Timezone | MST |
| Offset | -0700, -07, -07:00, Z0700, Z07:00 |
Formats prédéfinis
Les constantes de format prédéfinies pour les dates et horodatages sont également disponibles :
| Name | Format |
|---|---|
| ANSIC | Mon Jan _2 15:04:05 2006 |
| UnixDate | Mon Jan _2 15:04:05 MST 2006 |
| RubyDate | Mon Jan 02 15:04:05 -0700 2006 |
| RFC822 | 02 Jan 06 15:04 MST |
| RFC822Z | 02 Jan 06 15:04 -0700 |
| RFC850 | Monday, 02-Jan-06 15:04:05 MST |
| RFC1123 | Mon, 02 Jan 2006 15:04:05 MST |
| RFC1123Z | Mon, 02 Jan 2006 15:04:05 -0700 |
| RFC3339 | 2006-01-02T15:04:05Z07:00 |
| RFC3339Nano | 2006-01-02T15:04:05.999999999Z07:00 |
| Kitchen | 3:04PM |
| Stamp | Jan _2 15:04:05 |
| StampMilli | Jan _2 15:04:05.000 |
| StampMicro | Jan _2 15:04:05.000000 |
| StampNano | Jan _2 15:04:05.000000000 |
Exemples
Pour afficher l'heure dans plusieurs fuseaux horaires, en utilisant les fonctions de date de Sprig :
{{ .CurrentDate | date .Format }} {{ dateInZone "15:04Z" .CurrentDate "UTC" }}