Converting seconds since the Unix epoch to RFC 2822 format
Moderator: General Moderators
-
starsol
- Forum Newbie
- Posts: 24
- Joined: Thu Jul 31, 2003 8:30 am
- Location: Norfolk, England.
- Contact:
Converting seconds since the Unix epoch to RFC 2822 format
I would imagine this is pretty easy, but I must be overlooking something in the manual as I just can't seem to figure out how to do it. Can anyone give me a hint?
-
starsol
- Forum Newbie
- Posts: 24
- Joined: Thu Jul 31, 2003 8:30 am
- Location: Norfolk, England.
- Contact:
Thanks anjanesh, but I think you have misunderstood what I'm trying to do.
as you pointed out provides the RFC 2822 formatted date for now. What I want to do is take the time in seconds since the Unix epoch, then convert it to RFC 2822.
For example, an article in my database was first created at 1116329331 seconds since the Unix epoch. I am trying to create a function that takes that number, and converts it into something like Tue, 17 May 2005 13:34:07 +0000 (thats not the actual time it converts into, just an example).
Code: Select all
echo date("r");For example, an article in my database was first created at 1116329331 seconds since the Unix epoch. I am trying to create a function that takes that number, and converts it into something like Tue, 17 May 2005 13:34:07 +0000 (thats not the actual time it converts into, just an example).
-
starsol
- Forum Newbie
- Posts: 24
- Joined: Thu Jul 31, 2003 8:30 am
- Location: Norfolk, England.
- Contact:
Found solution: I just needed to add the time to the date function.
Code: Select all
date('r', 1116329331)