What is the best, most user friendly way of selecting a time or a time span on the web? Is it good to use something like a date picker for time or maybe sliders for time span? What is the best solution you have seen?
I'd say try to provide both sliders/time-pickers and a simple textfield which accepts as many different date/time representations as technically possible. Choosing just one or the other could prove limiting or confusing.
A good example of such an approach is http://www.hipmunk.com/
I would go for a calendar picker or two for a range. Make sure users can type the dates in too though, it's a lot quicker. I would go for imposing a format (aaaa-mm-dd hh:mm:ss) to avoid confusing day and month, for example, rather than trying to parse any format. Otherwise, the user could be hesitant as to which formats will work and which wont.
For a date, I would use a datapicker, including a text box for direct input, pre-populated with the format specification, so that it is clear how the date should be formatted. Try to make the datepickers default date somewhere around where it should be - defaulting to today is not always the best option. You should do everything you can to make the use of the datepicker as easy as possible, because that is the best way of ensuring that the format is correct.
For a timespan, I would look at using a slider of sorts, very much depending on the scale of the timespan used and the required accuracy. At the same time, make sure that the selected timespan is displayed in text boxes, and can be amended.