Monday, July 28, 2014

Maintain date format in Excel for Clarity Data migration

Function GetPhilipsWeekYear(getDate As String)
 Dim weeknumber As String
 Dim YYYear As String
 Dim mmmonth As String
 Dim strDate As String
 Dim dddate As String
If getDate <> "" Then
 ' Getting the Week Number and Any format will convert to "mm-dd-yyyy"

strDate = Format(getDate, "mm-dd-yyyy")
 weeknumber = Application.WorksheetFunction.WeekNum(strDate, 21)
 ' Getting the year from the date
 YYYear = Year(getDate)
 mmmonth = Month(getDate)
 dddate = Day(getDate)

 GetPhilipsWeekYear = YYYear & "-" & mmmonth & "-" & dddate & "Bala"
End If
End Function