Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.7K Views
|
3 Replies
|
1 Total Like
View groups...
Share
Share this post:

Use "Switch" command in a "Input" function?

Posted 9 years ago
POSTED BY: Brandon Davis
3 Replies

You could use:

DateString["12 January 2016", {"Month", "/", "Day", "/", "YearShort"}]
POSTED BY: Sander Huisman
Posted 9 years ago

@Sander,

Thanks for the clarification. I'm pretty certain I'm going to need to now create an "If" statement that will utilize my 3 "Input" functions, "month", "day" and "year" so that I can eventually get the output of "mm/dd/yyyy", for whichever month, day and year a user enters. Am I wrong?

POSTED BY: Brandon Davis

Put the months in quotes, they are strings, furthermore the auxiliary variable a is not needed:

color[monthSwitch_] := 
 Switch[monthSwitch, "January", "01", "February", "02", "March", "03",
   "April", "04", "May", "05", "June", "06", "July", "07", "August", 
  "08", "September", "09", "October", "10", "November", "11", 
  "December", "12", _, monthSwitch]
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard