Get the date in the right format

Some times is difficult to get the right format for a date by using the function now() or date() and try to get the day, month and year in the right way.
dd-mmyyyy, dd-mm-yyyy, dd.mm.yyyy or mm-ddyyyy, mm-dd-yyyy, mm.dd.yyyy
The following function take the argument like 0, +1, -1 (day) and so on, and as result return the date in the right format. You just need to change the last line day_of_year in other to reach your need. All other settings are taken from system time like regional settings (doesn’t matter in which form is the input).

Function day_of_year(arg)
	If len(DatePart("m",DateAdd("d", arg, Date))) = 1 Then
		check_month = "0" &  DatePart("m",DateAdd("d", arg, Date))
	Else 
		check_month = DatePart("m",DateAdd("d", arg, Date))
	End If
	If len(DatePart("d",DateAdd("d", arg, Date))) = 1 Then
		check_day = "0" &  DatePart("d",DateAdd("d", arg, Date))
	Else 
		check_day = DatePart("d",DateAdd("d", arg, Date))
	End If
day_of_year = DatePart("yyyy",DateAdd("d", arg, Date)) & check_month & "-" & check_day
End Function