Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个日期时间值以这种方式声明为字符“1985-01-01-00:00”,我想将年、月和日提取为整数。我不知道 FORTRAN 语言的确切命令。
例如:
program zz character(20) :: ch = "1985-01-01-00:00" integer yyyy,mm,dd read(ch(1:4),'(i)') yyyy read(ch(6:7),'(i)') mm read(ch(9:10),'(i)') dd write(*,*) yyyy, mm, dd end program zz