Weekday

Blitz3D Forums/Blitz3D Beginners Area/Weekday

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You guys are trying to hack your way through... why don't you just make a straight call to the Windows API?

Something like this:
;.lib "Kernel32.dll"
;GetDateFormat%(iLocale%, iFlags%, iDate%, iFormat$, oDateBuf*, iSizeBuf%):"GetDateFormatA"

date = CreateBank(256)
size = GetDateFormat(0, 0, 0, "dddd", date, BankSize(date))
Print BankToString(date, size)
Delay 1000
End

Function BankToString$(b, size)
	For i = 0 To size-2 ; (null-terminated)
		s$ = s$ + Chr$(PeekByte(b,i))
	Next
	Return "Today is "+s$+"."
End Function

Output:
Today is Thursday.

You can even specify different locales if you want. This works in Win95 and up.