Re: Week number and day number...

Tech-Archive recommends: Fix windows errors by optimizing your registry



First, DatePart takes a string as the first parameter.

As to the * 100, you said you wanted a NUMBER not a string of numbers. To
get that I need to move the week number over two places (multiply by 100)
and then add the weekday to that. IF you just need a string of number
characters:
Format(DatePart("ww",SomeDateField,2),"00") & DatePart("w",firstdayofweek,
2)

That gets the week number and formats it as two number characters - so week
1 to 9 are shown as 01 to 09 then gets the day number and tacks the number
onto the end, so you end up with 013 for the first week, 3rd day.

DatePart("ww",Now()) will return the week number based on the which week has
january 1 in it being week 1
Your other choices for the first week are the first week in the year that
has at least 4 days in it in the year. So if Jan 1 was on Saturday, the
week with Jan 1 would NOT be the first week since (depending on your start
day) there would only be 1 or 2 days in that week.


"Michael" <michael@xxxxxxxxxxxxx> wrote in message
news:uB7jX2E4FHA.3628@xxxxxxxxxxxxxxxxxxxxxxx
> Thank you John
> I have looked at the help and I am still stuck. I do not understand what
> should be in the 1st somedate field or the use of the * 100. The help
> explains the 1st week of the year is the week in which Jan 1 falls is the
> default week so I cannot imagine what datefield should be in the first
> part.
>
> =DatePart("ww",SomeDateField)* 100 + DatePart("w",firstdayofweek, 2)
>
> trying to use the help template ( DatePart («interval»; «date»;
> «firstweekday»; «firstweek») ) for datepart I tried to get just the week
> by using this =DatePart([ww];Now();[vbFirstJan1])
>
> also this =DatePart([ww];Now();2;1)
>
> sorry I am confused, can you help me a little other or point me to
> somewhere else to find an answer?
> Michael
>
>
> "John Spencer" <spencer@xxxxxxxxx> ha scritto nel messaggio
> news:uAx5Wh73FHA.1188@xxxxxxxxxxxxxxxxxxxxxxx
>> Take a look at the DatePart function.
>> DatePart("ww",SomeDateField)* 100 + DatePart("w",SomeDateField, 2)
>>
>> I suggest you check out the DatePart function in Visual Basic help as
>> there are additional parameters you can use to specify which day of the
>> week is the first day of the week and how to define the first week of the
>> year. Be aware that if you are using these in a query, you will need to
>> use the values of the vbConstants (vbMonday = 2)
>>
>> "Michael" <michael@xxxxxxxxxxxxx> wrote in message
>> news:eGU%23r%2363FHA.3160@xxxxxxxxxxxxxxxxxxxxxxx
>>>I have to have a number that denotes the week number (the number of weeks
>>> that have past this year) for example this week is the 44th week. then a
>>> number that denotes the day of the week 01-07 (Monday would be 01) so
>>> today
>>> being wed. would be 4403. Is there a simple way to do this?
>>> thank you
>>> Michael
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: Filter of TObjects
    ... This is a real programming problem. ... The actual filtering code isn't hard, because it defers all the hard ... an object (first parameter). ... means you have to interpret that string, fill in the variables from the ...
    (comp.lang.pascal.delphi.misc)
  • Re: Quarantine rqc parameter details
    ... Regarding the first parameter which you pass to rqc, it is the name of the ... dial up connectoid which is created when you installed the CM profile. ... STRING to the RQS on the server side. ...
    (microsoft.public.isa.vpn)
  • Re: Quarantine rqc parameter details
    ... Regarding the first parameter which you pass to rqc, it is the name of the ... dial up connectoid which is created when you installed the CM profile. ... STRING to the RQS on the server side. ...
    (microsoft.public.isa)
  • Re: Quarantine rqc parameter details
    ... Regarding the first parameter which you pass to rqc, it is the name of the ... dial up connectoid which is created when you installed the CM profile. ... STRING to the RQS on the server side. ...
    (microsoft.public.isa)
  • Re: Quarantine rqc parameter details
    ... Regarding the first parameter which you pass to rqc, it is the name of the ... dial up connectoid which is created when you installed the CM profile. ... STRING to the RQS on the server side. ...
    (microsoft.public.win2000.ras_routing)