This job is to convert 2 functions (NumDayOfWeek and DowsInMonth) from VB6 into Javascript.
I need this immediately. Please be prepared to begin work immediately.
1. Convert this NumDayOfWeek function from VB6 into Javascript.
'// This function returns the date of the day of the week specified
'// by month, number of weekday occurred in the month, and the
'// day of the week.
'// Mth is "Month", Num is passed "number of weekday occurred in the month,
'// and Dow is passed for
'// "Day of Week", the date (day) is returned as the result.
Public Function NumDayOfWeek(Mth As Long, Num As Long, Dow As Long) As Long
'// Day of week (Dow) reference
'// 1 = Sunday 2 = Monday 3 = Tuesday 4 = Wednesday
'// 5 = Thursday 6 = Friday 7 = Saturday
'// Return the actual date.
NumDayOfWeek = (8 - Weekday(DateSerial(theYear, Mth, 1), (Dow + 1) Mod 8)) + ((Num - 1) * 7)
End Function
NOTES:
DateSerial is a VB6 function. You will need to study what it did, from the VB6 references online, and reproduce it's functionality. I think it simply creates dates by imputting Year, Month, Day, so the Javascript New Date() function should work.
WeekDay is a VB6 function. You will need to study what it did, from the VB6 references online, and reproduce it's functionality. I already found one source code example of this, in Javascript, in the attached file.
theYear is supposed to hold the current year. But the line of code that sets that global variable, wass outside theVB6 function.
Instead of that, I'd like the Javascript version to set the current year, inside the NumDayOfWeek function.
Here are examples of calling the NumDayOfWeek function. These are random lines of code, gathered together, in VB6.
DSTStartDateStamp = 300 + NumDayOfWeek(3, 2, 1) '// Second Sunday of March (should return 13 )
DSTEndDateStamp = 1100 + NumDayOfWeek(11, 1, 1) '// First Sunday of November (should return 6)
DSTStartDateStamp = 300 + NumDayOfWeek(3, DowsInMonth(3, 1), 1) '// Last Sunday of March (should return 27 )
DSTEndDateStamp = 1000 + NumDayOfWeek(10, DowsInMonth(10, 1), 1) '// Last Sunday of October (should return 30)
2. Convert this DowsInMonth function from VB6 into Javascript.
'// This function calculates the number of time the specified week day
'// occurs in the specified month.
'// Mth is passed for "Month", Dow is passed for
'// "Day of week", Number of day occurances is returned,
Public Function DowsInMonth(Mth As Long, Dow As Long) As Long
On Error Resume Next '// In case DateSerial function runs into an invalid date for the month.
Dim DowLoop As Long '// Variable for date loop
Dim DowCalc As Long '// Used to calculate the number of days before returning it.
Dim MonthDayLimit As Long '// Limit of days in the month to loop through.
'// Get the last day of the month specified.
MonthDayLimit = Day(DateSerial(theYear, Mth + 1, 0))
'// Reset the Days of week count for the month
DowCalc = 0
'// Count how many days of the weekday specified that are in the month
For DowLoop = 1 To MonthDayLimit
If Weekday(DateSerial(theYear, Mth, DowLoop)) = Dow Then
DowCalc = DowCalc + 1
End If
Next DowLoop
'// Return the number of days found.
DowsInMonth = DowCalc
End Function
NOTES:
Forget about "On Error Resume Next". That's not needed for the Javascript version.
theYear was a global set to current year (2016), For the Javascript version, set it to current year inside this function.
DateSerial is a VB6 function, which you hopefully figured out and converted into Javascript in part 1.
Day is a VB6 function, which you can read about in the Visual Basic VB6 online documentation. The Javascript .getDate() should work instead.
WeekDay is a VB6 function, which you hopefully figured out and converted into javascript in part 1.
Dear Hiring Manager,
we will do it for you with perfection and we will keep working on it until you are 110% satisfied with results. Feel free to message me. we can discuss price and project in [login to view URL] are looking for opportunities to excel in this [login to view URL] us a chance to prove ourselves.
Thank You
$30 USD në 1 ditë
5,0 (26 përshtypje)
4,5
4,5
3 freelancers are bidding on average $23 USD for this job