|
Hello Joel ! Thanks, I'll try it out. You could use the following code to determine the week number which I stored in my archives (don't remember from where I get it). Best regards Ewart * ================================================================== * = Service program... Dates = * = Description....... Date routines = * ================================================================== H NoMain * ================================================================== * = Prototypes = * ================================================================== * ------------------------------------------------------------------ * - RtvDayOfWeek Retrieve day of week - * - - * - Parameter Usage Type - * - Date Input Date field - * - - * - Return data - * - Day of week Return Integer (0=Monday, 1=Tuesday, ...) - * ------------------------------------------------------------------ D RtvDayOfWeek PR 5I 0 D D Value * ------------------------------------------------------------------ * - RtvWeekOfYear Retrieve week of year - * - - * - Parameter Usage Type - * - Date Input Date field - * - - * - Return data - * - Week of year Return Integer - * ------------------------------------------------------------------ D RtvWeekOfYear PR 5I 0 D D Value * ================================================================== * = Procedure..... RtvDayOfWeek = * = Description... Retrieve day of week = * ================================================================== P RtvDayOfWeek B Export D RtvDayOfWeek PI 5I 0 D DateIn D Value D BaseMonday S D Inz( D'2001-05-21' ) D NbrDays S 10I 0 * ------------------------------------------------------------------ * - Calculate and return day of week - * ------------------------------------------------------------------ C DateIn SubDur BaseMonday NbrDays : *D C Return ( %Rem( %Rem( NbrDays : 7 ) + 7 : 7 ) ) P RtvDayOfWeek E * ================================================================== * = Procedure..... RtvWeekOfYear = * = Description... Retrieve week of year = * ================================================================== RtvWeekOfYear B Export D RtvWeekOfYear PI 5I 0 D DateIn D Value D DS D Jan4Date D Inz( D'0001-01-04' ) D Jan4Year 4S 0 Overlay( Jan4Date ) D MondayDate S D D Jan4Day S 5I 0 D NbrOfDays S 10I 0 * ------------------------------------------------------------------ * - Set date to January 4 of target year and use to calculate the - * - date of the first Monday of the target year - * ------------------------------------------------------------------ C Extrct DateIn:*Y Jan4Year C Eval Jan4Day = RtvDayOfWeek( Jan4Date ) C Jan4Date SubDur Jan4Day:*D MondayDate * ------------------------------------------------------------------ * - If the target date is prior to the first Monday of the target - * - year, adjust the year to reflect the prior year and calculate - * - the date of the first Monday of the year again - * ------------------------------------------------------------------ C If DateIn < MondayDate C Eval Jan4Year = Jan4Year - 1 C Eval Jan4Day = RtvDayOfWeek( Jan4Date ) C Jan4Date SubDur Jan4Day:*D MondayDate C EndIf * ------------------------------------------------------------------ * - Calculate the week of the year and return the value - * ------------------------------------------------------------------ C DateIn SubDur MondayDate NbrOfDays:*D C Return ( NbrOfDays / 7 ) + 1 P RtvWeekOfYear E To: RPGNext Discussion and Information <rpgnext@xxxxxxxxxxxx> Joel Cochran <jrc@xxxxxxxxxx> cc: Sent by: rpgnext-bounces@xxxxxxxxxxxx 2004/09/10 11:26 PM Please respond to RPGNext Discussion Subject: and Information Re: [RPGNext] New Version almost ready... On Fri, 2004-09-10 at 15:31, Ewart Desouza wrote: > > How about the reverse of getdateCYMD like getdateISO i.e. input date = > 7,0 > > & output = yyyy-mm-dd. > > I'm not sure I understand... you mean send the 7,0 variable and get the > ISO string back? > > Yes in ISO date format same as %date() You can already get the functionality by sending getDateStrISO() a date created by your CYMD value: /free dateString = getDateStrISO( %date( dateCYMD : *CYMD ) ); /end-free Unless there is something else I'm missing... Joel http://www.rpgnext.com _______________________________________________ This is the RPGNext Discussion and Information (RPGNext) mailing list To post a message email: RPGNext@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpgnext or email: RPGNext-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpgnext.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.