Ich habe mir mal vor einiger Zeit 'n Macro/Prozedur geschrieben, die das FormatDate() von PB ersetzt und den Syntax von PHP nutzt, u.a. auch für ausgeschriebene Wochen-/Monatstage (deutsch):
Code: Alles auswählen
#FormatDateEx_WeekdayName = "Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag"
#FormatDateEx_MonthName = "Jannuar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember"
CompilerIf Defined(CharacterArray, #PB_Structure) = #False
Structure CharacterArray
c.c[0]
EndStructure
CompilerEndIf
Procedure.s FormatDateEx(Mask.s, Date.i)
Protected *Character.CharacterArray = @Mask
Protected Index.i, FixIndex.i, String.s
If *Character
While *Character\c[Index]
If *Character\c[Index] = '%'
String + PeekS(@*Character\c[FixIndex], Index-FixIndex)
Select *Character\c[Index+1]
Case '%'
String + "%"
Case 'd'
String + RSet(Str(Day(Date)), 2, "0")
Case 'D'
String + LSet(StringField(#FormatDateEx_WeekdayName,DayOfWeek(Date),","), 2)
Case 'F'
String + StringField(#FormatDateEx_MonthName,Month(Date),",")
Case 'g'
String + Str((Hour(Date)+11)%12+1)
Case 'G'
String + Str(Hour(Date))
Case 'h'
String + RSet(Str((Hour(Date)+11)%12+1), 2, "0")
Case 'H'
String + RSet(Str(Hour(Date)), 2, "0")
Case 'i'
String + RSet(Str(Minute(Date)), 2, "0")
Case 'j'
String + Str(Day(Date))
Case 'l'
String + StringField(#FormatDateEx_WeekdayName,DayOfWeek(Date),",")
Case 'm'
String + RSet(Str(Month(Date)), 2, "0")
Case 'M'
String + LSet(StringField(#FormatDateEx_MonthName,Month(Date),","), 3)
Case 'n'
String + Str(Month(Date))
Case 's'
String + RSet(Str(Second(Date)), 2, "0")
Case 'w'
String + Str(DayOfWeek(Date))
Case 'y'
String + Right(Str(Year(Date)),2)
Case 'Y'
String + Str(Year(Date))
Case 'z'
String + Str(DayOfYear(Date))
EndSelect
Index + 1
FixIndex = Index+1
EndIf
Index + 1
Wend
String + PeekS(@*Character\c[FixIndex], Index-FixIndex)
EndIf
ProcedureReturn String
EndProcedure
Macro FormatDate(Mask, Date)
FormatDateEx(Mask, Date)
EndMacro
Debug FormatDate("Heute ist %l, der %j. %F %Y, %H:%i Uhr", Date())