cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
lisamaley
Level III

Date Week of the year

I have a date code that gives me the year, day of the week (Saturday for instance) and the week of the year (week 50 for instance).   Is there a way to change this information into a date?

 

I have a MacBook Monterey 12.6 with JMP Pro version 17.0

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Date Week of the year

This equation will calculate the date given the 3 variables you specified

In Years( :year - 1904 ) + In Weeks( :week of the year ) + In Days( :day of the week )

This equation assumes the week of the year begins on January 1.  If your data has a rule for what day the week of the year begins, like the first Sunday of the year that offset will have to be calculated and then added to the formula.

Jim

View solution in original post

Craige_Hales
Super User

Re: Date Week of the year

Also, make allowances for day-of-week and week-of-year starts with 0 or 1.

 

Jim is right, there are a lot of ways you might define week of the year. Many of the worst bugs I've worked on had something to do with time calculations. Test your code carefully!

Craige

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Date Week of the year

This equation will calculate the date given the 3 variables you specified

In Years( :year - 1904 ) + In Weeks( :week of the year ) + In Days( :day of the week )

This equation assumes the week of the year begins on January 1.  If your data has a rule for what day the week of the year begins, like the first Sunday of the year that offset will have to be calculated and then added to the formula.

Jim
Craige_Hales
Super User

Re: Date Week of the year

Also, make allowances for day-of-week and week-of-year starts with 0 or 1.

 

Jim is right, there are a lot of ways you might define week of the year. Many of the worst bugs I've worked on had something to do with time calculations. Test your code carefully!

Craige
lisamaley
Level III

Re: Date Week of the year

I changed it to a number first and it worked!

lisamaley
Level III

Re: Date Week of the year

Thank you!  this worked!