Subject: bug#25112: 24.5; function to encode time from time string

From: Drew Adams <[email-masked]>
Date: Mon, 5 Dec 2016 13:49:56 -0800 (PST)

> > Enhancement request: Please add a function that accepts a time
> > string and a format spec (to interpret the time string), and
> > returns a time value that represents the same time.
> 
> I believe you want either date-to-time or parse-time-string (the
> former is just a thin wrapper around the latter).  date-to-time is
> described in the ELisp manual.

Sheesh.  Dunno how I missed `date-to-time' in the manual.  I read
the 3 nodes about dates & times, but clearly I didn't read them
well enough.

Maybe it would help to mention this direction of conversion after
the second paragraph of node `Time of Day', with a cross-reference?

And maybe the node named `Time Conversion' should mention something
about conversion both directions between strings and times, with
cross-references?

Anyway, `date-to-time' does what I want (though it seems to give
only a 2-element list, at least in the cases I've tried).

Its name does NOT seem very good, though.  Among other things,
either a date or a time can be represented as either a list or
a string - neither is inherently only one or the other.

It might help to say something like:

 (current-time-string (date-to-time date-time-string)) =
 date-time-string

and

 (date-to-time (current-time-string date-time-list)) =
 date-time-list

Or if these are not always strictly true then at least point out
that this is the general idea.

E.g.,

 (current-time-string (date-to-time "Sun Nov 27 16:38:38 2016")) =
 "Sun Nov 27 16:38:38 2016"

 (date-to-time (current-time-string '(22587 31886))) = (22587 31886)

I will close this bug, in any case.  Thx.