web development India freelance website designer
When passing a date (format of DD/MM/YYYY) and a three letter code for a day of the week (Mon, Tue, Wed etc...) to
this function, it will calculate the date of that day from the date given
Useful To work out a week ending Date If you never know that users will ALWAYS specify a week-ending date. This is
the first Function of it's kind on PSC. If it's any use, please vote.
You must pass the date you wish to calculate from and then the TLA of the day name. For example, Mon = Monday,
Tue = Tuesday, Wed = Wednesday, etc...
Will return the calculated date of the day name given.


Private Sub Form_Load()
MsgBox Calculate_Week_Ending_Date(Format(Now, "DD/MM/YYYY"), "Fri")
End Sub

Function Calculate_Week_Ending_Date(Date_String As String, Week_Ending_Day As String)
Dim Day_Increment As Integer
Day_Increment = 0
For Day_Increment = 0 To 6
If Format(DateAdd("d", Day_Increment, Date_String), "ddd") = Week_Ending_Day Then
Calculate_Week_Ending_Date = DateAdd("d", Day_Increment, Date_String)
Exit Function
End If
Next Day_Increment
End Function
Calculate week ending date from current date

1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550

Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design