UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
July
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Our Sponsors
Sponsor Advertisements help keep UGN Security Online.



Support UGN Security by Purchasing our Sponsors Products.

Want to earn prizes for clicking online advertisements? Join Rewards1.com.
Latest Postings
Racism
by kanemartin
Yesterday at 01:28 PM
Apple's new Anti-Piracy issue
by ZER0_DECEPTION
06/20/09 04:12 AM
ToorCamp 09
by ZER0_DECEPTION
06/20/09 03:56 AM
MooreR is FREE.
by ZER0_DECEPTION
06/20/09 03:43 AM
Jelly Belly Pudding - It'll literally make you sick to your stomach...
by Gizmo
06/16/09 01:31 PM
Using Vb and Counter-Strike
by ashgray2
06/03/09 10:09 PM
Removal of shortcut arrow in XP
by ashgray2
06/03/09 10:03 PM
Suggest me good speakers
by ashgray2
06/03/09 09:59 PM
Page 1 of 2 1 2 >
Topic Options
Rate This Topic
#19240 - 09/04/05 05:42 PM PHP - Replacing output format of date...
Gizmo Online   shocked

Community Owner
*****

Registered: 02/28/02
Posts: 7074
Loc: Portland, OR; USA
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, Elite Web Gamers & VNC Web Design Owner

Top
Our Sponsors
Sponsor Our Sponsors

Sponsor Advertisements help keep UGN Security Online.



Support UGN Security by Purchasing our Sponsors Products.
Top  
#19241 - 09/06/05 11:21 AM Re: PHP - Replacing output format of date...
§intå× Offline

UGN Elite
*****

Registered: 12/03/02
Posts: 3252
Loc: here
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.
_________________________
My New site OpenEyes

Top
#19242 - 09/07/05 01:20 AM Re: PHP - Replacing output format of date...
Gizmo Online   shocked

Community Owner
*****

Registered: 02/28/02
Posts: 7074
Loc: Portland, OR; USA
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, Elite Web Gamers & VNC Web Design Owner

Top
#19243 - 09/07/05 08:15 PM Re: PHP - Replacing output format of date...
§intå× Offline

UGN Elite
*****

Registered: 12/03/02
Posts: 3252
Loc: here
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 ass...
/*
$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.
_________________________
My New site OpenEyes

Top
#19244 - 09/08/05 09:10 PM Re: PHP - Replacing output format of date...
§intå× Offline

UGN Elite
*****

Registered: 12/03/02
Posts: 3252
Loc: here
so did this help?
_________________________
My New site OpenEyes

Top
#19245 - 09/08/05 10:17 PM Re: PHP - Replacing output format of date...
Gizmo Online   shocked

Community Owner
*****

Registered: 02/28/02
Posts: 7074
Loc: Portland, OR; USA
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, Elite Web Gamers & VNC Web Design Owner

Top
#19246 - 09/14/05 09:11 AM Re: PHP - Replacing output format of date...
Gizmo Online   shocked

Community Owner
*****

Registered: 02/28/02
Posts: 7074
Loc: Portland, OR; USA
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, Elite Web Gamers & VNC Web Design Owner

Top
#19247 - 09/14/05 10:48 PM Re: PHP - Replacing output format of date...
§intå× Offline

UGN Elite
*****

Registered: 12/03/02
Posts: 3252
Loc: here
hmmmm... So you are getting some corupt unix epoch...

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

Segments please, no big ass page of code.

Oh did I mention I hate time coding? This shit is soooo tedious and difficult.
_________________________
My New site OpenEyes

Top
#19248 - 09/15/05 04:17 AM Re: PHP - Replacing output format of date...
Gizmo Online   shocked

Community Owner
*****

Registered: 02/28/02
Posts: 7074
Loc: Portland, OR; USA
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, Elite Web Gamers & VNC Web Design Owner

Top
#19249 - 09/15/05 05:05 AM Re: PHP - Replacing output format of date...
Gizmo Online   shocked

Community Owner
*****

Registered: 02/28/02
Posts: 7074
Loc: Portland, OR; USA
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, Elite Web Gamers & VNC Web Design Owner

Top
#19250 - 09/16/05 05:14 PM Re: PHP - Replacing output format of date...
Ron M Offline
Junior Member

Registered: 09/13/05
Posts: 6
Loc: Des Moines, IA
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.
_________________________
STOP 0x9452356 - SIGNATURE_NOT_AVAILABLE

Top
#19251 - 09/16/05 06:11 PM Re: PHP - Replacing output format of date...
Gizmo Online   shocked

Community Owner
*****

Registered: 02/28/02
Posts: 7074
Loc: Portland, OR; USA
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 ...
_________________________
Donate to UGN Security here.
UGN Security, Elite Web Gamers & VNC Web Design Owner

Top
#19252 - 09/16/05 07:05 PM Re: PHP - Replacing output format of date...
Ron M Offline
Junior Member

Registered: 09/13/05
Posts: 6
Loc: Des Moines, IA
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;

?>
_________________________
STOP 0x9452356 - SIGNATURE_NOT_AVAILABLE

Top
#19253 - 09/16/05 11:44 PM Re: PHP - Replacing output format of date...
Gizmo Online   shocked

Community Owner
*****

Registered: 02/28/02
Posts: 7074
Loc: Portland, OR; USA
Hey ron, quick question; what time is it when it's 12:30pm ...

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, Elite Web Gamers & VNC Web Design Owner

Top
#19254 - 09/19/05 04:30 PM Re: PHP - Replacing output format of date...
Ron M Offline
Junior Member

Registered: 09/13/05
Posts: 6
Loc: Des Moines, IA
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.
_________________________
STOP 0x9452356 - SIGNATURE_NOT_AVAILABLE

Top
Page 1 of 2 1 2 >



Moderator:  §intå×, Gizmo 
Featured Member
Registered: 08/05/08
Posts: 1
Forum Stats
6955 Members
44 Forums
12342 Topics
47295 Posts

Max Online: 678 @ 06/30/07 10:06 PM
Top Posters
Gizmo 7074
UGN Security 5466
§intå× 3252
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 954
Girlie 904
unreal 860
Newest Members
Pro Seller CVVs, LFD, Cheguevara, thizzlatin, ksual
6954 Registered Users
Who's Online
4 registered (thizzlatin, Gizmo, Kayolix, kanemartin), 311 Guests and 75 Spiders online.
Key: Admin, Global Mod, Mod
Latest News


Donate
  Get Firefox!
Get FireFox!