datetime Function

public pure function datetime(year, month, day, hour, minute, second, millisecond, utc_offset_minutes) result(dt)

Create a datetime_type from individual components.

Arguments

Type IntentOptional Attributes Name
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
integer, intent(in), optional :: utc_offset_minutes

Return Value type(datetime_type)


Source Code

    pure function datetime(year, month, day, hour, minute, &
                           second, millisecond, &
                           utc_offset_minutes) result(dt)
        !! version: experimental
        !!
        !! Create a datetime_type from individual components.
        integer, intent(in), optional :: year, month, day
        integer, intent(in), optional :: hour, minute, second
        integer, intent(in), optional :: millisecond
        integer, intent(in), optional :: utc_offset_minutes
        type(datetime_type) :: dt
        if (present(year))        dt%year        = year
        if (present(month))       dt%month       = month
        if (present(day))         dt%day         = day
        if (present(hour))        dt%hour        = hour
        if (present(minute))      dt%minute      = minute
        if (present(second))      dt%second      = second
        if (present(millisecond)) dt%millisecond = millisecond
        if (present(utc_offset_minutes)) &
            dt%utc_offset_minutes = utc_offset_minutes
    end function datetime