all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Timestamps and php
@ 2009-11-15  0:24 Xavier Maillard
  2009-11-15  6:14 ` tomas
  0 siblings, 1 reply; 3+ messages in thread
From: Xavier Maillard @ 2009-11-15  0:24 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

Using a XML-RPC call, I am returned this information:

:datetime (19198 34091)

I'd like this to be transformed in something I can read. I know
encode/decode functions but I don't know how I can display the
result using format-time-string. Any idea ?

While at it, how can I convert a date into a "PHP timestamp"
which, as far as I know, looks like 1258190619.0.

Thank you.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Timestamps and php
  2009-11-15  0:24 Timestamps and php Xavier Maillard
@ 2009-11-15  6:14 ` tomas
  2009-11-15  8:58   ` [SOLVED] " Xavier Maillard
  0 siblings, 1 reply; 3+ messages in thread
From: tomas @ 2009-11-15  6:14 UTC (permalink / raw)
  To: Xavier Maillard; +Cc: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, Nov 15, 2009 at 01:24:38AM +0100, Xavier Maillard wrote:
> Hi,
> 
> Using a XML-RPC call, I am returned this information:
> 
> :datetime (19198 34091)
> 
> I'd like this to be transformed in something I can read. I know
> encode/decode functions but I don't know how I can display the
> result using format-time-string. Any idea ?

(format-time-string "%Y-%m-%d %H:%M:%S" (current-time) t)
  => "2009-11-15 06:14:49"

[That's in UTC -- see the function doc for tons and tons of options]

> While at it, how can I convert a date into a "PHP timestamp"
> which, as far as I know, looks like 1258190619.0.

Whatever a "PHP timestamp" may be, but it looks a lot like the number of
seconds since the Epoch. You might give the function float-time a try.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFK/5wqBcgs9XrR2kYRApICAJ9b38WttJKlbwEVoUO/+3lHF9hTPwCfTCu9
wMMpCzmoDHvkophyyhX7QqI=
=tAfM
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [SOLVED] Re: Timestamps and php
  2009-11-15  6:14 ` tomas
@ 2009-11-15  8:58   ` Xavier Maillard
  0 siblings, 0 replies; 3+ messages in thread
From: Xavier Maillard @ 2009-11-15  8:58 UTC (permalink / raw)
  To: tomas; +Cc: help-gnu-emacs

Hi,

   On Sun, Nov 15, 2009 at 01:24:38AM +0100, Xavier Maillard wrote:
   > Hi,
   > 
   > Using a XML-RPC call, I am returned this information:
   > 
   > :datetime (19198 34091)
   > 
   > I'd like this to be transformed in something I can read. I know
   > encode/decode functions but I don't know how I can display the
   > result using format-time-string. Any idea ?

   (format-time-string "%Y-%m-%d %H:%M:%S" (current-time) t)
     => "2009-11-15 06:14:49"

I know why I was into trouble, I passed a decoded time (via
decode-time) which gave weird results. I did not read the
docstring carefully...

   [That's in UTC -- see the function doc for tons and tons of options]

   > While at it, how can I convert a date into a "PHP timestamp"
   > which, as far as I know, looks like 1258190619.0.

   Whatever a "PHP timestamp" may be, but it looks a lot like the number of
   seconds since the Epoch. You might give the function float-time a try.

I did not notice this function before. Thank you very much !

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-15  8:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-15  0:24 Timestamps and php Xavier Maillard
2009-11-15  6:14 ` tomas
2009-11-15  8:58   ` [SOLVED] " Xavier Maillard

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.