- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve:
I posted this incorrectly in the MK Forum, sorry.
I wanted to use the JTIME routine in the IFPORT Library.
Your help files has it as a function, but it now appears to be a called subroutine.
Your
results = Jtime()
returns an error on compile
call Jtime(results)
works fine.
Just letting you know.
The help viewer when trying to call up the Fortran Help Files crashes a lot. I have VS upto date and latest Fortran.
When Help Viewer works it is great, but it is a bit weird with the crashes.
JMN
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
USE IFPORT
INTEGER(4) int_time
character*8 char_time
int_time = TIME( )
call TIME(char_time)
print *, 'Integer: ', int_time, 'time: ', char_time
END
Parent topic:
T to ZThis is similar in my book and from your current help manual. I do not have the code here to try it, but I will try it tonight. int_time was called results in JTIME and it did not compile. Nor did the JTIME help section give this option : call JTIME(char_time), I just struck it by trial and error.
So I am a bit lost, as to which function to use, if the other is preferred from IFport, can the help reflect that in JTIME.
JTIME no longer comes up in your help manual if I search for it, is that because it is obsolete?
Regards
JMN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
USE IFPORT
INTEGER(4) int_time
character*8 char_time
int_time = TIME( )
call TIME(char_time)
print *, 'Integer: ', int_time, 'time: ', char_time
END
Parent topic:
T to ZThis is similar in my book and from your current help manual. I do not have the code here to try it, but I will try it tonight. int_time was called results in JTIME and it did not compile. Nor did the JTIME help section give this option : call JTIME(char_time), I just struck it by trial and error.
So I am a bit lost, as to which function to use, if the other is preferred from IFport, can the help reflect that in JTIME.
JTIME no longer comes up in your help manual if I search for it, is that because it is obsolete?
Regards
JMN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The program below compiles and prints out the correct JDATE.
[fortran]program main USE IFPORT character*8 a_jdate a_jdate = JDATE( ) print *, 'JDATE for Today: ', a_jdate END [/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One of the problems of working on projects over a long time is you can get lost. Plus working on a computer at home and then using the work computer for talking on this site.
I need the year as 2012 not 12.
your code works fine if I accept the 12 as the year, but in my printout I was looking for 2012. This requires JDATE4. This code below generates an error on the jdate4, that is eliminated with a call statement.
Your help shows jdate4 as below, I just checked the latest help. But it gives this error:
Error 1 error #6553: A function reference is invoking a subroutine subprogram. [JDATE4] b:\john\documents\visual studio 2010\Projects\Console2\Console2\Console2.f90 20
My comment is about the error in the help file for JDATE4, sorry I got the code mixed up.
[bash]program main USE IFPORT character*8 a_jdate character*10 b_jdate a_jdate = JDATE( ) b_jdate = jdate4() print *, 'JDATE for Today: ', a_jdate, b_jdate END [/bash]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue number is #DPD200177877.
Regards,
Annalee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I normally do use the date and time intrinsic. This is the first time I have used the Julian Date, but for this program I wanted the Julian date so I can track the created files easily. There is no argument that 36 th day is in February, but 2/11 could be 2 Nov or 11 Feb depending on your location.
Regards
JMN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The point of using Julian dates is 1) concision, as each Julian can be represented in a 4-byte integer, and 2) direct interval arithmetic, as the day span between any two dates is the simple difference of their Julian representations.
Here are forward and reverse routines for moving between Julian dates and ymd:
[bash]FUNCTION julian_date (yyyy, mm, dd) RESULT (julian) IMPLICIT NONE ! converts calendar date to Julian date ! cf Fliegel & Van Flandern, CACM 11(10):657, 1968 ! example: julian_date(1970,1,1)=2440588 INTEGER,INTENT(IN) :: yyyy,mm,dd INTEGER :: julian julian = dd - 32075 + 1461*(yyyy + 4800 + (mm - 14)/12)/4 + & 367*(mm - 2 - ((mm - 14)/12)*12)/12 - & 3*((yyyy + 4900 + (mm - 14)/12)/100)/4 END FUNCTION julian_date SUBROUTINE get_ymd (jd, yyyy, mm, dd) IMPLICIT NONE ! expands a Julian date into a calendar date ! cf Fliegel & Van Flandern, CACM 11(10):657, 1968 INTEGER,INTENT(IN) :: jd INTEGER,INTENT(OUT) :: yyyy,mm,dd INTEGER :: l,n l = jd + 68569 n = 4*l/146097 l = l - (146097*n + 3)/4 yyyy = 4000*(l + 1)/1461001 l = l - 1461*yyyy/4 + 31 mm = 80*l/2447 dd = l - 2447*mm/80 l = mm/11 mm = mm + 2 - 12*l yyyy = 100*(n - 49) + yyyy + l END SUBROUTINE get_ymd [/bash]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can work around this issue for now by excluding the JDATE4 interface from IFPORT and declaring your own interface for JDATE4 as a function.
To exclude JDATE4, change the use statement to:
USE IFPORT, UNUSED=>JDATE4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page