Loading...
Searching...
No Matches
fpx_date Module Reference

Derived types and interfaces

type  datetime
 Compact representation of date and time Stores all components in minimal integer kinds to reduce memory usage. All fields are public for easy access. More...
 

Functions/Subroutines

elemental type(datetime) function datetime_new (year, month, day, hour, minute, second, millisecond)
 
elemental type(datetime) function datetime_new_from_string (string, fmt)
 
type(datetime) function, public now ()
 Return current local date and time Uses intrinsic date_and_time() and populates all fields including milliseconds.
 
pure elemental integer function weekday (this)
 
elemental subroutine datetime_parse (this, string, fmt)
 Parse date/time from string using common formats.
 
character(:) function, allocatable datetime_to_string (this, fmt)
 Format datetime as string using flexible format codes Supports many common patterns including those required for __DATE__ and __TIMESTAMP__. Default format: 'yyyy-MM-ddTHH:mm:ss' Remarks.
 

Function/Subroutine Documentation

◆ datetime_new()

elemental type(datetime) function datetime_new ( integer, intent(in), optional year,
integer, intent(in), optional month,
integer, intent(in), optional day,
integer, intent(in), optional hour,
integer, intent(in), optional minute,
integer, intent(in), optional second,
integer, intent(in), optional millisecond )
private

Definition at line 120 of file date.f90.

◆ datetime_new_from_string()

elemental type(datetime) function datetime_new_from_string ( character(*), intent(in) string,
character(*), intent(in), optional fmt )
private

Definition at line 139 of file date.f90.

◆ datetime_parse()

elemental subroutine datetime_parse ( class(datetime), intent(inout) this,
character(*), intent(in) string,
character(*), intent(in), optional fmt )
private

Parse date/time from string using common formats.

Supports ISO, US, and abbreviated month formats. On error, defaults to Unix epoch (1970-01-01 00:00:00) Perform conversion to ISO string

  • d: Represents the day of the month as a number from 1 through 31.
  • dd: Represents the day of the month as a number from 01 through 31.
  • ddd: Represents the abbreviated name of the day (Mon, Tues, Wed, etc).
  • dddd: Represents the full name of the day (Monday, Tuesday, etc).
  • h: 12-hour clock hour (e.g. 4).
  • hh: 12-hour clock, with a leading 0 (e.g. 06)
  • H: 24-hour clock hour (e.g. 15)
  • HH: 24-hour clock hour, with a leading 0 (e.g. 22)
  • m: Minutes
  • mm: Minutes with a leading zero
  • M: Month number(eg.3)
  • MM: Month number with leading zero(eg.04)
  • MMM: Abbreviated Month Name (e.g. Dec)
  • MMMM: Full month name (e.g. December)
  • s: Seconds
  • ss: Seconds with leading zero
  • t: Abbreviated AM / PM (e.g. A or P)
  • tt: AM / PM (e.g. AM or PM
  • y: Year, no leading zero (e.g. 2015 would be 15)
  • yy: Year, leading zero (e.g. 2015 would be 015)
  • yyy: Year, (e.g. 2015)
  • yyyy: Year, (e.g. 2015)

Remarks

Definition at line 238 of file date.f90.

◆ datetime_to_string()

character(:) function, allocatable datetime_to_string ( class(datetime), intent(in) this,
character(*), intent(in), optional fmt )
private

Format datetime as string using flexible format codes Supports many common patterns including those required for __DATE__ and __TIMESTAMP__. Default format: 'yyyy-MM-ddTHH:mm:ss' Remarks.

Definition at line 350 of file date.f90.

◆ weekday()

pure elemental integer function weekday ( class(datetime), intent(in) this)
private

Definition at line 188 of file date.f90.