Convertproblem 
Author Message
 Convertproblem
Hi!
The problem is that i want to convert YYWW to YYYY-MM.
That is for example  95(year) 36(week) to 1995-09-01.
I really need some help with this problem.

Thanks Jan



Fri, 09 Nov 2001 03:00:00 GMT
 Convertproblem

Follow theese steps.

Dimension a startdate and set it to the first day of
a KNOWN year

    Dim StartDate as Variant
    StartDate = DateSerial (KnownYear, 1,1)

Then add to this date the number of weeks you need
using dateadd function to achive your targetdate.

    Dim TargetDate as Variant
    TargetDate = DateAdd("ww",NumberOfWeeks,StartDate)

By last use your target date as you prefer.

    Debug.Print Format$(TargetDate,"YYYY-MM-DD")

Hope this helps.

--
Andrea Lanfranchi
My Software Never Has Bugs
It Only Develops Random Features
-------------------------------------------------------------------------
Please remove "nospam" from my address if you
want to reply.


Quote:
> Hi!
> The problem is that i want to convert YYWW to YYYY-MM.
> That is for example  95(year) 36(week) to 1995-09-01.
> I really need some help with this problem.

> Thanks Jan



Fri, 09 Nov 2001 03:00:00 GMT
 Convertproblem
'WeekDate => "YYWW"
FromWeekToDate = DateSerial(Left(WeekDate, 2), 1, Mid(WeekDate, 3) * 7 - 6)


Fri, 09 Nov 2001 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Convertproblems


 
Powered by phpBB® Forum Software