Package com.ssgllc.fish.f.instant
Class F_Instant
java.lang.Object
com.ssgllc.fish.f.instant.F_Instant
-
Field Summary
FieldsModifier and TypeFieldDescriptionMove forwards:f().instant.now().add.hours(2).Distance to another moment:f().instant.now().elapsed.minutes.after(start).The underlying moment, for handing to Java APIs that want anInstant.Comparisons:f().instant.now().is.after(entity.createdDate).Move backwards:f().instant.now().subtract.days(30). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe moment formatted with a pattern, in the US locale and the system default zone.The moment formatted with a pattern in a given locale, in the system default zone.The moment formatted with a pattern, in a given locale and zone.toIso()The moment as an ISO-8601 instant string in UTC.
-
Field Details
-
instant
The underlying moment, for handing to Java APIs that want anInstant. -
is
Comparisons:f().instant.now().is.after(entity.createdDate). -
add
Move forwards:f().instant.now().add.hours(2). -
subtract
Move backwards:f().instant.now().subtract.days(30). -
elapsed
Distance to another moment:f().instant.now().elapsed.minutes.after(start).
-
-
Constructor Details
-
F_Instant
-
-
Method Details
-
format
The moment formatted with a pattern, in the US locale and the system default zone. Useformat(String, String, String)to control the zone, which matters whenever the output is shown to a user.- Parameters:
format- the format pattern- Returns:
- the formatted moment
Groovy example:
f().instant.now().format("MM/dd/yyyy h:mm a")
Returns:
"08/21/2026 9:45 AM"
SpEL example:
#f().instant.now().format("MM/dd/yyyy h:mm a")
-
format
The moment formatted with a pattern in a given locale, in the system default zone.- Parameters:
format- the format patternlocale- a BCP 47 locale tag, e.g."es-US"- Returns:
- the formatted moment
Groovy example:
f().instant.now().format("MMMM d, yyyy", "es-US")
Returns:
"agosto 21, 2026"
SpEL example:
#f().instant.now().format("MMMM d, yyyy", "es-US")
-
format
The moment formatted with a pattern, in a given locale and zone. The explicit zone is the reason to prefer this overload for anything a user reads: the same instant is a different wall-clock time in each zone.- Parameters:
format- the format patternlocale- a BCP 47 locale tagtimezone- the zone id, e.g."America/Los_Angeles"- Returns:
- the formatted moment
Groovy example:
f().instant.now().format("h:mm a", "en-US", "America/Los_Angeles")
Returns:
"6:45 AM"
SpEL example:
#f().instant.now().format("h:mm a", "en-US", "America/Los_Angeles")
-
toIso
The moment as an ISO-8601 instant string in UTC. This is what the value serialises to, and the right form for a payload another system will parse.- Returns:
- the moment in ISO-8601
Groovy example:
f().instant.now().toIso()
Returns:
"2026-08-21T13:45:12.335Z"
SpEL example:
#f().instant.now().toIso()
-