gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
dccaldatetochar.f90
Go to the documentation of this file.
1! -*- mode: f90; coding: utf-8 -*-
2!-----------------------------------------------------------------------
3! Copyright (c) 2000-2026 Gtool Development Group. All rights reserved.
4!-----------------------------------------------------------------------
21
56function dccaldatetochar1( year, month, day, hour, min, sec, zone ) &
57 & result(result)
58
59 use dc_types, only: string, token, dp
61 use dc_message, only: messagenotify
62 implicit none
63 character(STRING):: result
64 integer, intent(in):: year
65 integer, intent(in):: month
66 integer, intent(in):: day
67 integer, intent(in):: hour
68 integer, intent(in):: min
69 real(dp), intent(in):: sec
70 character(*), intent(in), optional:: zone
71 integer:: csec_len
72 character(STRING):: csec
73 character(TOKEN):: zonew
74continue
75
76 if ( present(zone) ) then
77 zonew = zone
78 else
79 zonew = ''
80 end if
81
82 csec = tochar(sec)
83 csec = roundnum( csec )
84 if ( trim(csec) == '-0.' ) csec = '0.'
85 do while ( index('123456789.', csec(len_trim(csec):len_trim(csec)) ) == 0 )
86 if ( len_trim(csec) < 2 ) exit
87 csec = csec(1:len_trim(csec)-1)
88 end do
89 if (int(sec) > -1 .and. int(sec) < 10) then
90 if (len_trim(csec) >= len(csec)) then
91 csec = '0' // trim(csec(1:len(csec) - 1))
92 else
93 csec = '0' // trim(csec)
94 end if
95 end if
96 csec_len = len(trim(adjustl(csec)))
97 if (csec(csec_len:csec_len) == '.') csec = csec(1:csec_len-1)
98
99 result = cprintf('%04d-%02d-%02dT%02d:%02d:%c%c', &
100 & i=(/year, month, day, hour, min/), &
101 & c1=trim(csec), c2=trim(zonew))
102
103end function dccaldatetochar1
character(string) function dccaldatetochar1(year, month, day, hour, min, sec, zone)
日時の文字列への変換
メッセージの出力
文字型変数の操作
Definition dc_string.f90:83
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition dc_types.f90:128
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137