Skip to content

use RFC3339 CreatedAt time format in docker compose ps --format=json output #12520

Closed as not planned
@trim21

Description

@trim21

Description

Description

Normally in json we use RFC3339(Nano) time format in json but in current output of json output it's "CreatedAt":"2025-02-02 08:40:17 +0000 UTC", which is a very "strange" format.

Steps To Reproduce

No response

Compose Version

Docker Compose version v2.28.1

Docker Environment


Anything else?

how to do this:

diff --git a/cmd/formatter/container.go b/cmd/formatter/container.go
index f1eb47caf5..13e7708560 100644
--- a/cmd/formatter/container.go
+++ b/cmd/formatter/container.go
@@ -183,7 +183,7 @@ func (c *ContainerContext) Command() string {
 }
 
 func (c *ContainerContext) CreatedAt() string {
-	return time.Unix(c.c.Created, 0).String()
+	return time.Unix(c.c.Created, 0).Format(time.RFC3339Nano)
 }
 
 func (c *ContainerContext) RunningFor() string {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions