libsim  Versione7.2.1

◆ datetime_new()

elemental type(datetime) function, public datetime_class::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  msec,
integer(kind=int_ll), intent(in), optional  unixtime,
character(len=*), intent(in), optional  isodate,
character(len=*), intent(in), optional  simpledate 
)

Initialize a datetime object according to the provided arguments If no arguments are passed a missing object is created.

Notice that the optional parameter groups (year, month, hour, minute, msec), (unixtime), (isodate), (simpledate) are mutually exclusive, the results are not guaranteed if arguments of different groups are present.

Parametri
[in]yearyear a.C.; for reasons not yet investigated, only years >0 (a.C.) are allowed
[in]monthmonth, default=1 if year is present, it can also be outside the interval 1-12, the function behaves reasonably in that case
[in]dayday, default=1 if year is present, it can have non canonical values too
[in]hourhours, default=0 if year is present, it can have non canonical values too
[in]minuteminutes, default=0 if year is present, it can have non canonical values too
[in]msecmilliseconds, default=0 if year is present, it can have non canonical values too
[in]unixtimeinitialize the object to unixtime seconds after 1/1/1970, UNIX convention, notice that this is an 8-byte integer
[in]isodateinitialize the object to a date expressed as a string YYYY-MM-DD hh:mm:ss.msc, (iso format), the initial part YYYY-MM-DD is compulsory, the remaining part is optional
[in]simpledateinitialize the object to a date expressed as a string YYYYMMDDhh:mm:ss.msc, (iso format), the initial part YYYYMMDD is compulsory, the remaining part is optional

Definizione alla linea 726 del file datetime_class.F90.

726 ELEMENTAL FUNCTION datetime_le(this, that) RESULT(res)
727 TYPE(datetime),INTENT(IN) :: this, that
728 LOGICAL :: res
729 
730 IF (this == that) THEN
731  res = .true.
732 ELSE IF (this < that) THEN
733  res = .true.
734 ELSE
735  res = .false.
736 ENDIF
737 
738 END FUNCTION datetime_le
739 
740 
741 FUNCTION datetime_add(this, that) RESULT(res)
742 TYPE(datetime),INTENT(IN) :: this
743 TYPE(timedelta),INTENT(IN) :: that
744 TYPE(datetime) :: res
745 
746 INTEGER :: lyear, lmonth, lday, lhour, lminute, lmsec
747 
748 IF (this == datetime_miss .OR. that == timedelta_miss) THEN
749  res = datetime_miss
750 ELSE
751  res%iminuti = this%iminuti + that%iminuti
752  IF (that%month /= 0) THEN
753  CALL getval(res, year=lyear, month=lmonth, day=lday, hour=lhour, &
754  minute=lminute, msec=lmsec)
755  CALL init(res, year=lyear, month=lmonth+that%month, day=lday, &
756  hour=lhour, minute=lminute, msec=lmsec)
757  ENDIF
758 ENDIF
759 
760 END FUNCTION datetime_add
761 
762 
763 ELEMENTAL FUNCTION datetime_subdt(this, that) RESULT(res)
764 TYPE(datetime),INTENT(IN) :: this, that
765 TYPE(timedelta) :: res
766 
767 IF (this == datetime_miss .OR. that == datetime_miss) THEN
768  res = timedelta_miss
769 ELSE
770  res%iminuti = this%iminuti - that%iminuti
771  res%month = 0
772 ENDIF
773 
774 END FUNCTION datetime_subdt
775 
776 
777 FUNCTION datetime_subtd(this, that) RESULT(res)
778 TYPE(datetime),INTENT(IN) :: this
779 TYPE(timedelta),INTENT(IN) :: that
780 TYPE(datetime) :: res
781 
782 INTEGER :: lyear, lmonth, lday, lhour, lminute, lmsec
783 
784 IF (this == datetime_miss .OR. that == timedelta_miss) THEN
785  res = datetime_miss
786 ELSE
787  res%iminuti = this%iminuti - that%iminuti
788  IF (that%month /= 0) THEN
789  CALL getval(res, year=lyear, month=lmonth, day=lday, hour=lhour, &
790  minute=lminute, msec=lmsec)
791  CALL init(res, year=lyear, month=lmonth-that%month, day=lday, &
792  hour=lhour, minute=lminute, msec=lmsec)
793  ENDIF
794 ENDIF
795 
796 END FUNCTION datetime_subtd
797 
798 
803 SUBROUTINE datetime_read_unit(this, unit)
804 TYPE(datetime),INTENT(out) :: this
805 INTEGER, INTENT(in) :: unit
806 CALL datetime_vect_read_unit((/this/), unit)
807 
808 END SUBROUTINE datetime_read_unit
809 
810 
815 SUBROUTINE datetime_vect_read_unit(this, unit)
816 TYPE(datetime) :: this(:)
817 INTEGER, INTENT(in) :: unit
818 
819 CHARACTER(len=40) :: form
820 CHARACTER(len=23), ALLOCATABLE :: dateiso(:)

Generated with Doxygen.