I say that depends entirely on the two sets of data and how much detail is given.
If the relation between input and output is unambiguous, I'd say it's on-topic.
Otherwise it might be "too broad" or "unclear".
I would consider such a question on-topic:
I have a unix timestamp (like 1444495607
) and want to convert it to a date string, like 10.10.2015 18:46:47
. How can I do that in [language]?
However, I would vote to close as "too broad" if it were less detailed, like:
How can I convert timestamp to date string in [language]?
Because "date string" is rather ambiguous, and not every representation is suitable for every use case. For example, you probably wouldn't want a JS-like string of Sat Oct 10 2015 18:50:18 GMT+0200 (CEST)
to be displayed to an end user.
The amount of detail required also depends on the complexity of the data. For example, converting an integer to a string is a pretty unambiguous request, but if there was a question like
I have the following string:
"d4f56g4d156"
How can I convert it to a JSON string like
"{year:\"2015\",data:{herp:\"Derp\"}}"
?
Then I'd vote to close as "unclear what you're asking", because I cannot see any relation between the two data sets.
Similarly, I would consider a request to convert an array to a String in Java "too broad", and a request to convert a HashMap
into an array "unclear".
Also, if they do not specify a language, the question is likely going to be too broad, but there are a few cases where this doesn't have to be the case, namely if all of the following apply:
- The task they want to do is not part of a bigger program
- The task they want to do does not depend on the programming language
- You have enough information about their environment to chose a language you know they have available
For example, I consider the following perfectly answerable:
I have a folder structure that is up to five folders deep, and I want to rename the folders, to prefix them with _pdf
if they contain any pdf files. I'm on Ubuntu, how can I do that?
This could be answered by a bash script, for example.
But the following request would be pretty much unanswerable:
How can I turn the following JSON object into an array?
["herp", "a", "derp"]
Java? JavaScript? PHP? ...?
TL;DR: It depends.
too-broad
tag here? If the question has an answer "use time.mktime()"; it is not too broad. "off-topic" and "too-broad" are not synonyms: there are off-topic questions that are not too broad.