Switch quantity not an integer

I am trying to use the Switch test in my sketch and the piece of code is :-

switch (tstDate) {
case '25.12':{

Where the 'tstDate' contains a day& month date as shown above., but I get the compilation error show in the subject of this post. I was always under the impression that one could use any variable type in Switch statements, so I am puzzled at the reference 'not an Integer'. Where am I going wrong ??

The switch statement requires an integer. Turn your date into one... eg dayofyear...


case '25.12':In addition to it not being an integer, neither is the value a char as the single quotes would seem to imply. What exactly is the format and data type of tstDate ?

Thanks Bob for reply. tstdate is a substring of chars representing Day/Month values which is read from an Rtc chip. ie DS1302. I know one can use ’ If /then tests on strings why not in Switch values. ???

I know one can use ' If /then tests on strings why not in Switch values. ???

because it is what it is.

condition - any expression of integral or enumeration type, or of a class type contextually implicitly convertible to an integral or enumeration type, or a declaration of a single non-array variable of such type with a brace-or-equals initializer.

Ask Kernighan and Ritchie.

If you’re using the arduino DS1302 driver, read the DS1302.h file - that makes all clear.