Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Death, when unnecessary, is a tragic thing. -- Flint, "Requiem for Methuselah", stardate 5843.7


devel / comp.lang.xharbour / Re: does exist revese function of week( dData )

SubjectAuthor
* does exist revese function of week( dData )Marco Boschi
`* Re: does exist revese function of week( dData )dlzc
 `* Re: does exist revese function of week( dData )Marco Boschi
  `- Re: does exist revese function of week( dData )dlzc

1
does exist revese function of week( dData )

<5ceacd4b-d89f-4824-9d33-f5758fd8e505n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16939&group=comp.lang.xharbour#16939

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:ad4:4ee7:: with SMTP id dv7mr4142878qvb.48.1642779028081;
Fri, 21 Jan 2022 07:30:28 -0800 (PST)
X-Received: by 2002:a05:6214:c8f:: with SMTP id r15mr4098717qvr.78.1642779027877;
Fri, 21 Jan 2022 07:30:27 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Fri, 21 Jan 2022 07:30:27 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=185.55.90.130; posting-account=_oyAawkAAAAkDmcMkD9UQrwxJqiaol5l
NNTP-Posting-Host: 185.55.90.130
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5ceacd4b-d89f-4824-9d33-f5758fd8e505n@googlegroups.com>
Subject: does exist revese function of week( dData )
From: info@marcoboschi.it (Marco Boschi)
Injection-Date: Fri, 21 Jan 2022 15:30:28 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 1
 by: Marco Boschi - Fri, 21 Jan 2022 15:30 UTC

This function must returns the first day of te week passed as parameter
many thanks

Re: does exist revese function of week( dData )

<430e6e8a-38a6-4443-8304-a11d2f0c9b55n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16940&group=comp.lang.xharbour#16940

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:ac8:7f15:: with SMTP id f21mr4436592qtk.601.1642789173225;
Fri, 21 Jan 2022 10:19:33 -0800 (PST)
X-Received: by 2002:a05:6214:e89:: with SMTP id hf9mr4924280qvb.43.1642789172722;
Fri, 21 Jan 2022 10:19:32 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Fri, 21 Jan 2022 10:19:32 -0800 (PST)
In-Reply-To: <5ceacd4b-d89f-4824-9d33-f5758fd8e505n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=68.107.209.13; posting-account=7bF0GwoAAABMFHX6V4fON4-1F6LFJ834
NNTP-Posting-Host: 68.107.209.13
References: <5ceacd4b-d89f-4824-9d33-f5758fd8e505n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <430e6e8a-38a6-4443-8304-a11d2f0c9b55n@googlegroups.com>
Subject: Re: does exist revese function of week( dData )
From: dlzc1@cox.net (dlzc)
Injection-Date: Fri, 21 Jan 2022 18:19:33 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: dlzc - Fri, 21 Jan 2022 18:19 UTC

On Friday, January 21, 2022 at 8:30:28 AM UTC-7, Marco Boschi wrote:
> This function must returns the first day of te week passed as parameter
> many thanks

As stated, this function will do it.

function FirstDayOfWeek( dData )
return 1

But you probably meant
function DateOfFirstDayOfWeek( dData )
return dData - dow(dData) + 1

David A. Smith

Re: does exist revese function of week( dData )

<33cfecb4-aa2c-4cb7-8dd1-d7dc1353438dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16942&group=comp.lang.xharbour#16942

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a37:381:: with SMTP id 123mr6079572qkd.768.1642866395426;
Sat, 22 Jan 2022 07:46:35 -0800 (PST)
X-Received: by 2002:a05:620a:13f7:: with SMTP id h23mr6149646qkl.771.1642866395183;
Sat, 22 Jan 2022 07:46:35 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Sat, 22 Jan 2022 07:46:34 -0800 (PST)
In-Reply-To: <430e6e8a-38a6-4443-8304-a11d2f0c9b55n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2.234.134.164; posting-account=_oyAawkAAAAkDmcMkD9UQrwxJqiaol5l
NNTP-Posting-Host: 2.234.134.164
References: <5ceacd4b-d89f-4824-9d33-f5758fd8e505n@googlegroups.com> <430e6e8a-38a6-4443-8304-a11d2f0c9b55n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <33cfecb4-aa2c-4cb7-8dd1-d7dc1353438dn@googlegroups.com>
Subject: Re: does exist revese function of week( dData )
From: info@marcoboschi.it (Marco Boschi)
Injection-Date: Sat, 22 Jan 2022 15:46:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 72
 by: Marco Boschi - Sat, 22 Jan 2022 15:46 UTC

Il giorno venerdì 21 gennaio 2022 alle 19:19:33 UTC+1 dlzc ha scritto:
> On Friday, January 21, 2022 at 8:30:28 AM UTC-7, Marco Boschi wrote:
> > This function must returns the first day of te week passed as parameter
> > many thanks
> As stated, this function will do it.
>
> function FirstDayOfWeek( dData )
> return 1
>
> But you probably meant
> function DateOfFirstDayOfWeek( dData )
> return dData - dow(dData) + 1
>
> David A. Smith
If I run this little program I obtain the list below

FUNCTION MAIN()
LOCAL iday
LOCAL nWeek
LOCAL cDay
iDay := DATE()
DO WHILE .T.
nDayOfWeek := DOW( iDay )
nWeek := week( iDay )
cDay := cdow( iDay )
? iDay , nDayOfWeek , PADR( cDay , 20 ) , nWeek
iDay --
inkey(0)

ENDDO

01/22/22 7 Saturday 3
01/21/22 6 Friday 3
01/20/22 5 Thursday 3
01/19/22 4 Wednesday 3
01/18/22 3 Tuesday 3
01/17/22 2 Monday 3
01/16/22 1 Sunday 3
01/15/22 7 Saturday 2
01/14/22 6 Friday 2
01/13/22 5 Thursday 2
01/12/22 4 Wednesday 2
01/11/22 3 Tuesday 2
01/10/22 2 Monday 2
01/09/22 1 Sunday 2
01/08/22 7 Saturday 1
01/07/22 6 Friday 1
01/06/22 5 Thursday 1
01/05/22 4 Wednesday 1
01/04/22 3 Tuesday 1
01/03/22 2 Monday 1
01/02/22 1 Sunday 1
01/01/22 7 Saturday 52

Today is Jaunary 22 2022 And is Saturday week 3

I need a function that returns Hanuary 16 2022 if I pass 3

01/22/22 7 Saturday 3 last day of 3^ week
01/21/22 6 Friday 3
01/20/22 5 Thursday 3
01/19/22 4 Wednesday 3
01/18/22 3 Tuesday 3
01/17/22 2 Monday 3
01/16/22 1 Sunday 3 first day of 3^ week

? dMondayOfWeek( 3 )
result 01/16/22
I thought it existed I create it thanks

Re: does exist revese function of week( dData )

<b8aa6f9f-0d61-4940-97eb-a6b2ae60d7e5n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16943&group=comp.lang.xharbour#16943

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:ac8:5c89:: with SMTP id r9mr13087342qta.42.1643039019192;
Mon, 24 Jan 2022 07:43:39 -0800 (PST)
X-Received: by 2002:ad4:5c6b:: with SMTP id i11mr5861453qvh.95.1643039018954;
Mon, 24 Jan 2022 07:43:38 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!2.eu.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Mon, 24 Jan 2022 07:43:38 -0800 (PST)
In-Reply-To: <33cfecb4-aa2c-4cb7-8dd1-d7dc1353438dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=68.107.209.13; posting-account=7bF0GwoAAABMFHX6V4fON4-1F6LFJ834
NNTP-Posting-Host: 68.107.209.13
References: <5ceacd4b-d89f-4824-9d33-f5758fd8e505n@googlegroups.com>
<430e6e8a-38a6-4443-8304-a11d2f0c9b55n@googlegroups.com> <33cfecb4-aa2c-4cb7-8dd1-d7dc1353438dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b8aa6f9f-0d61-4940-97eb-a6b2ae60d7e5n@googlegroups.com>
Subject: Re: does exist revese function of week( dData )
From: dlzc1@cox.net (dlzc)
Injection-Date: Mon, 24 Jan 2022 15:43:39 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 23
 by: dlzc - Mon, 24 Jan 2022 15:43 UTC

On Saturday, January 22, 2022 at 8:46:36 AM UTC-7, Marco Boschi wrote:
> Il giorno venerdì 21 gennaio 2022 alle 19:19:33 UTC+1 dlzc ha scritto:
> > On Friday, January 21, 2022 at 8:30:28 AM UTC-7, Marco Boschi wrote:
> > > This function must returns the first day of te week passed as parameter
> > > many thanks

I'd use DOY(dData) and WEEK(dData) to back into your answer. You just want to pass the week number, but not the year, is that correct? And you always want to return Monday, not Sunday?

function DateOfWeekThisYear( WeekNumber )
local nThisWeek := WEEK( date() )
local nThisDay := DOY( date() )
local nDOW := DOW( date() )
local nReturn := nThisDay + ( WeekNumber - nThisWeek ) * 7 - (nDOW + 2)
return BOY( date() ) + nReturn

Clearly not tested. Also no limits checks (53 weeks in a year for example)..

David A. Smith

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor