You're not using DayOfWeek, but FormatDateTime.
Your format string is this:
Code:
day-hh
If you look at the documentation of FormatDateTime and the Date-Time format strings, you'll probably see your problem:
d stands for the day number without leading zeroes, hh for hours with leading zeroes.
The a character is a bit more complicated: It's doing two things at once. First it will turn the number for h or hh into it's 12-hour-clock counterpart (if that h/hh is coming BEFORE the a/p symbol). And second it will print either a or p in place of the a character depending on whether the time is in the first or last 12 hours of the day.
Apparently the documentation has an error in that the single y also works for 2 digit years.
Right now it's 20:10 on the 2nd of February here, so the above format string will turn into:
Code:
2p19-20
If you'd like to stick with the FormatDateTime, you must use either:
Code:
ddd-hh
or
Code:
dddd-hh
With 3 ds giving you the short version of the weekday in your current locale and 4 ds giving you the long version of the weekday in your current locale.
If you want to add literal characters in your format string that should not be replaced, enclose them in double quotes.
To get the numerical representation of the weekday, use the DayOfWeek function, combine it with IntToStr and concatenate it with your formatted string.
Code:
datestring := IntToStr(DayOfWeek(Now)) + '-' + FormatDateTime('hh');
This would result in 7-20 being stored in the datestring variable, because for some stupid reason Pascal / Delphi / PAL is considering the week to start on Sundays.