Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Ok, I'm trying to code up an RSS2.0 output of the news that's displayed on the main page... I've got about 99% of everything done however I've run into a snag...

The UBB stores dates (presantly) as (08-31-2005 05:54 AM):
Code
Date("m-d-Y h:i A");
However RSS2.0 specs declare that the date MUST be (Sun, 04 Sep 2005 07:42:38 PDT):
Code
Date("D, d M Y H:i:s T");
Now, to tinker with the code to change how the date is displayed will effectively screw things up all over the site, so my PHP file will have to change the date format based on the date in the string "$postdate"...

Any ideas?


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
Why not just create a second variable in UBB?

when the call for $postdate("m-d-Y h:i A"); is made
doe a second call to $postdate2("D, d M Y H:i:s T"); Then pass postdate2 to PHP RSS2.0 script.

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Becuase I have no control over the output of the date; I was simply posting what format the date was in...

The $postdate is calling the date from the ubb thread files which are stored in plain text.


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
There should still be some perl code that create the flat file. But if not. Maybe mktime()

Thing is you would have to split(); it several ways to break out the variables from the first timestamp

http://us2.php.net/manual/en/function.split.php

$this_date = "$postdate";// date will be in this format m-d-Y h:i A

Code
$split1 = split("-:",$postdate);

/*this leaves us with this array
array(
   [0] => "M"
   [1] => "d"
   [2] => "Y "
   [3] => "h"
   [4] => "i A"
);
*/ 
so we could then trim $split1[2] and split $split1[4].
Code
$split2 = trim($split[2]);
$split3 = split(" ", $split[4]);

//now this is a pain in the [censored]...
/*
$split[0] is month
$split[1] is day
$split2 is year
$split1[3] is hour
$split3[0] is minutes
$split3[1] Ante meridiem and Post meridiem
*/
Now where you get s and T Seconds, with leading zeros and Timezone setting of the machine....

I guess you could default seconds to 00, and timezone is eazy enough.

Now then, mktime()... I hate time by the way...

Real quick summary of mktime
Code
mktime(hour, minute, second, month, day, year);
Now what we can do is this
Code
$My_new_date = date("D, d M Y H:i:s T", mktime($split1[3], $split3[0], 00, $split[0], $split[1], $split2));
That should work, I am not 100% on syntax I am sure, you might have to play with quotes around the array values.

Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
so did this help?

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
I got a lil ill last night so i didn't get a chance to apply it; i'll work on trying it tonight if i feel better.


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
It's reading the date off still; I'm getting:
Wed, 31 Dec 1969 15:59:59 PST

Instead of:
Tue, 30 Aug 2005 09:54:00 PST


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
hmmmm... So you are getting some corupt unix epoch...

let me think on it, email me the code you have.

Segments please, no big [censored] page of code.

Oh did I mention I hate time coding? This [censored] is soooo tedious and difficult.

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
to get the relay (do tests) you'd have to have shell access; do you still have it?


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
ok, literally, the incoming date/time are basically $postdate and $posttime when parsed from the forum; these two variables will come as:

$postdate = 08-31-2005
$posttime = 05:54 AM


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Sep 2005
Posts: 6
R
Junior Member
Offline
Junior Member
R
Joined: Sep 2005
Posts: 6
Hey Gizzy, I might be able to scrounge some debugging time up this weekend.

Judging by the input time, I'm guessing the logic is trying to do epoch -7 hours.

If you are using Ian's code
Code
$date = date( "D, d M Y H:i:s T" , strtotime( convert_date( $day . ' ' . $hour ) ));
you are only sending the day and hour to the script be processed. The Date is nowhere to be found in the convert_date.

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
I was trying to use ian's function/code but it got all sorts of wacky lol... What I have thus far is dirty as hell lol, wanna get it to work before trying to clean house and all wink ...


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Sep 2005
Posts: 6
R
Junior Member
Offline
Junior Member
R
Joined: Sep 2005
Posts: 6
Here's a snippet of code that I tried and it is practically working:

Code
<?

$postdate = "08-31-2005";
$posttime = "05:54 AM";

$pd_array = explode("-",$postdate);
$pt_array = split('[ :]',$posttime);
if ($pt_array[2] == "PM") {
	$pt_array[0] += 12;
}

$display2 = date("D, d M Y H:i:s T",mktime($pt_array[0], $pt_array[1], 0, $pd_array[0], $pd_array[1], $pd_array[2]));

echo $display2;

?>

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Hey ron, quick question; what time is it when it's 12:30pm wink ...

What I've got so far is here but we're still getting the date read wierd (time anyway); the original forum is here

I can get the blasted date to work, but the damned time...


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Sep 2005
Posts: 6
R
Junior Member
Offline
Junior Member
R
Joined: Sep 2005
Posts: 6
Oooops....

Code
<?

$postdate = "08-31-2005";
$posttime = "05:54 AM";

$pd_array = explode("-",$postdate);
$pt_array = split('[ :]',$posttime);
if ($pt_array[2] == "PM" && $pt_array[2] != 12) {
	$pt_array[0] += 12;
}

$display2 = date("D, d M Y H:i:s T",mktime($pt_array[0], $pt_array[1], 0, $pd_array[0], $pd_array[1], $pd_array[2]));

echo $display2;

?>
If you pass $posttime and $postdate to my code, it *should* work correctly. The time zone might be off if you have anything in $FudgedOffset.

Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
Bah I was on the right track sort of. I swear I hate time. Isn't there a way to conver to the UNIX epoch? Then you could just do the math in a function to create the date again however you wanted. Ganted that is a pain in the [censored] and takes a bit of thought with leap year, day light savings time and all that happy horse [censored].

Hey Ron M how does your script stand up against oddities like that?


Link Copied to Clipboard
Member Spotlight
Posts: 30
Joined: June 2002
Forum Statistics
Forums41
Topics33,840
Posts68,858
Average Daily Posts1
Members2,176
Most Online3,253
Jan 13th, 2020
Latest Postings
Where and how do you torrent?
by danni75 - 03/01/24 05:58 AM
Animation,
by JohanKaariainen - 08/15/19 01:18 AM
Blackbeard.....
by Gremelin - 10/03/18 07:02 PM
my old account still exists!
by Crime - 08/10/18 02:47 PM
Okay WTF?
by HenryMiring - 09/27/17 01:45 AM
The History Thread...
by Gremelin - 08/11/17 12:11 PM
My friend NEEDS your HELP!
by Lena01 - 07/21/17 12:06 AM
I'm having fun with this guy.
by gabithompson730 - 07/20/17 01:50 AM
I want to upgrade my phone
by gabithompson730 - 07/20/17 01:49 AM
Doom 3
by Cyrez - 09/11/14 08:58 PM
Amazon Gift Card Generator/KeyGen?te
by Gecko666 - 08/22/14 09:21 AM
AIM scene 99-03
by lavos - 09/02/13 08:06 AM
Planetside 2
by Crime - 03/04/13 07:10 AM
Beta Testers Wanted
by Crime - 03/04/13 06:55 AM
Hello Everyone
by Gremelin - 02/12/12 06:01 PM
Tracfone ESN Generator
by Zanvin Green - 01/18/12 01:31 PM
Python 3 issue
by Testing - 12/17/11 09:28 PM
tracfone airtime
by Drache86 - 07/30/11 03:37 AM
Backdoors and the Infinite
by ZeroCoolStar - 07/10/11 03:52 AM
HackThisZIne #12 Releaseed!
by Pipat2 - 04/28/11 09:20 PM
gang wars? l33t-wars?
by Gremelin - 04/28/11 05:56 AM
Consolidate Forums
by diggin2deep - 04/21/11 10:02 AM
LAN Hacking Noob
by Gremelin - 03/12/11 12:42 AM
Top Posters
UGN Security 41,392
Gremelin 7,203
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Likes Received
Ghost 2
Crime 1
Ice 1
Dartur 1
Cyrez 1
Powered by UBB.threads™ PHP Forum Software 7.7.5