Exforsys

Online Training

how can I convert today's date into julian date

This is a discussion on how can I convert today's date into julian date within the COBOL forums, part of the Programming Talk category; format using IBM cobol..?...


Go Back   Exforsys > Programming Talk > COBOL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-19-2007, 04:10 PM
Junior Member
 
Join Date: Mar 2007
Posts: 1
mapzaplap is on a distinguished road
how can I convert today's date into julian date

format using IBM cobol..?
__________________
Powered by Yahoo! Answers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2007, 03:43 PM
Senior Member
 
Join Date: Apr 2006
Posts: 122
rachelle is on a distinguished road
There are intrinsic date functions that deal with the conversions of date formats like Julian Dates, Gregorian dates. I have mentioned some of them for your use below:
* Convert from Gregorian to Integer formats
COMPUTE WS-INTEGER-DATE = FUNCTION INTEGER-OF-DATE (WS-DATE)

* Convert from Integer to Gregorian formats
COMPUTE WS-DATE = FUNCTION DATE-OF-INTEGER (WS-INTEGER-DATE)

* Convert from Julian to Integer formats
COMPUTE WS-INTEGER-DATE = FUNCTION INTEGER-OF-DAY (WS-JULIAN-DATE)

* Convert from Integer to Julian formats
COMPUTE WS-JULIAN-DATE = FUNCTION DAY-OF-INTEGER (WS-INTEGER-DATE)

Let me know if you have any other query.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-26-2007, 02:34 PM
Junior Member
 
Join Date: Jul 2007
Posts: 5
eddie13 is on a distinguished road
If you are like some who do not have the function options available, you could create a days in month table and calculate... you just have to deal with the Leap year. ie . if you divide the year by 4 and do not have a remainder and the date is after Feb, add 1 to the julian day. ... of course there is the 400 year to consider if not this year.

working-storage
01 ws-days-in-month-table.
05 ws-days-in-month pic x(24) value "312831303130313130313031".
05 ws-days-in-mo redefines ws-days-in-month pic 9(02).
...
05 ws-julian-date.
10 ws-julian-yr pic 9(02) value zero.
10 ws-julian-day pic 9(03) value zero.
05 ws-date.
10 ws-year pic 9(02) value zero.
10 ws-month pic 9(02) value zero.
10 ws-day pic 9(02) value zero.
05 i pic 9(02) value 01.

Procedure
accept ws-date from date.
move ws-year to ws-julian-yr.
compute i = ws-month - 1.
if i = zero move 12 to i.
compute ws-julian-day = ws-days-in-mo(i) + ws-day.

Last edited by eddie13 : 07-26-2007 at 02:38 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-26-2007, 03:18 PM
Junior Member
 
Join Date: Jul 2007
Posts: 5
eddie13 is on a distinguished road
of course some compilers (Liants RMCOBOL is one) have the "accept ws-julian-day from day" function for today's date. the other works when you need a date that is not today.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new questions
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Date Validation using SimpleDateFormat() insane Java Tutorials 0 05-05-2006 12:20 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit Tech FAQ 0 06-01-2004 06:00 AM
Robot Competition FAQ for June 2004 R. Steven Rainwater Tech FAQ 0 05-27-2004 08:59 PM
[FAQ] FileMaker Pro - database for Macintosh and Windows Martin Trautmann Tech FAQ 0 04-17-2004 07:26 AM
comp.os.msdos.programmer FAQ part 1/5 Jeffrey Carlyle Tech FAQ 1 04-09-2004 07:57 AM


All times are GMT -4. The time now is 02:14 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.