SB Anomalies RRS feed

  • Question

  • The way that this computer displays the date and time is 14:00 26-Jan- 13. Not what I wanted. What I wanted was for the date stamp to show the whole year - 26 Jan 2013. Ergo, the existence of the two subroutines below. The thing that I noticed was that the first sub uses the constructed variable TheDate. In order to format the date the way desired, it was necessary to create the second sub. The anomaly is that the first routine does not call the second yet when the program in which these are used does, in fact, display TheDate as 26 Jan 2013. Can anyone explain this, or do I just accept the serendipity?

    Sub UpdateClock
      TextWindowPlus.ForegroundColor = "white"
      TextWindowPlus.CursorLeft = 11
      TextWindowPlus.CursorTop = 3
      TextWindowPlus.CursorLeft = 11
      TextWindowPlus.CursorTop = 4
      TextWindowPlus.CursorLeft = 11
      TextWindowPlus.CursorTop = 5

    Sub FormatDate
      Test = TextPlus.GetSubText(Clock.Date, 8, 2)
      TheYear = Clock.Year
      TheDate = TextPlus.ReplaceSubText(Clock.Date, Test, TheYear)
      TheDate = TextPlus.ReplaceSubText(TheDate, "-", " ")

    Saturday, January 26, 2013 2:12 PM


  • Not quite sure what you mean but guessing?

    TextWindowPlus.Write(TheDate) : this uses the variable TheDate, it does not create the variable or call FormatDate.  To do this use: FormatDate() somewhere to set the variable TheDate.

    Perhaps provide a full working program with subroutine calls (as short as possible) that doesn't behave as you expect.

    Saturday, January 26, 2013 2:18 PM