klyn.time.DateTime.toString
method
public toString(format as String, locale as Locale) as String:
Description

Returns a string representation of this DateTime object using a specific locale.

Parameters
ParameterDescription
formatTokens: %Y, %y, %m, %d, %j, %w, %A, %a, %B, %b, %H, %I, %M, %S, %f, %p, %Z, %z, and %% for a literal percent sign. Unknown tokens are preserved. Inserted values are not parsed again.
localeThe locale to use for names and formatting.
Returns

A string representation of the DateTime object.

Throws
  • NullException if locale is null.
Example
import klyn.time
import klyn.i18n
dt = DateTime("2023-10-05 14:30:45")
print(dt.toString("%A %d %B %Y", Locale.FRANCE)) # jeudi 05 octobre 2023