|
Set up a table with twelve elements in it, containing the max number of days in each month - you obviously have to work out if its a leap year. To convert a date to julian eg 13/03/2002, you know its in the third month so you add the first two table elements together (31 + 28) = 59, and then add the days in the month you are working on. Therefore julian date = 59 + 13 = 72. To go from julian to Gregorian you start at element one, and subtract the max from the day, repeat this until the result is less than the number of days in the months. EG 02072 = 72 - 31 = 41 41 - 28 = 13 13 is less than 31 therefore it is the 13th day of the third month. Obviously you would code this into a loop. HTH JP "Taylor, Mike" <Mike.Taylor@aig.co To: "'cobol400-l@midrange.com'" m> <cobol400-l@midrange.com> Sent by: cc: cobol400-l-admin@mi Subject: julian date drange.com 22/03/2002 16:40 Please respond to cobol400-l What is the easiest way to convert a date to julian format. Thanks Mike. _______________________________________________ This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list To post a message email: COBOL400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l or email: COBOL400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l. ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. postmaster@bif.ie **********************************************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.