INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How do I get the daynumber/weeknumber out of a date
2

How do I get the daynumber/weeknumber out of a date

How do I get the daynumber/weeknumber out of a date

(OP)
Is there a Dibol subroutine that gives me the day of the week (1 = monday, 2 = tuesday, 3 = wednesday, etc) and the weeknumber converted from a single date. f.i. 19 dec 2003 (20031219 european format) is friday gives me as a result 20035105 (year 2003, weeknumber 51, day 05). Or has anybody written such a routine??

It would help me a lot.
kind regards.

RE: How do I get the daynumber/weeknumber out of a date

There are hundreds of websites out there with very interesting date algorithms, just take a google.

There has been a julian day intrinsic function in Synergy DBL since version... erm.. 6? I can't remember what it was called (I wrote it, so perhaps I should remember better)

This gives the number of days since a defined and fixed "zero date". You can use that to calculate weekdays.

RE: How do I get the daynumber/weeknumber out of a date

If you are using DBL, then you can:

   a) use the subroutine WKDAY to determine the day of the week. It returns 1=Sunday, 2=Monday, etc.

   b) use the subroutine JPERIOD to write an algorithum that will calculate the week number. "Week Number" is a little bit tricky, since not all companies may number the weeks in the same fashion.  Calling JPERIOD for a date will give you a Julian period for the specified date. The difference between any two julian period is the number of days between the dates.  You could then calculate the number of weeks between the two dates.  Depending on your corporate requirements, you may need to set the base date of the year to something other than Jan 1 (if, for example, weeks always start on the first monday of the year).

If you use DBL, and are under Help Desk support, you can also find a subroutine in the Synergex Code Exchange that will calculate a week number.  I've never used the routine, so I don't know the specifics of its calculation.

Hope this helps.

-- Bill Ferris
CSA Data Solutions
"Your Source For Synergy/DIBOL Services"
www.csadata.com

RE: How do I get the daynumber/weeknumber out of a date

(OP)
Thnx guy's.

The remaining problem for the number of the week (if jan 1 is on a friday to sunday then the weeknumber for 31 dec the year before is 53 else 52) is also solved, so now I have a complete routine for calculating yyyywwnn from yyyymmdd) using jperiod en setting 01 jan 1900 as monday.

E. de Jongh

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close