Sponsor Advertisements help keep UGN Security Online.
Support UGN Security by Viewing our Sponsors Products.
Want to earn prizes for clicking online advertisements? Join Rewards1.com.
|
|
|
Welcome to the UGN Security forums! You are currently viewing our forums as a guest which gives you limited access to most of our discussions and access to other features.
By joining our free community you will have access to post topics, communicate privately with our users (PM), respond to polls, upload content, and access many other features. Registration is fast, simple, and absolutely free; so please join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|
Sponsored Links
Sponsor 
|
Sponsor Advertisements help keep UGN Security Online.
Support UGN Security by Viewing our Sponsors Products.
|
| Top |
|
|
|
#19243 - 09/07/05 08:15 PM
Re: PHP - Replacing output format of date...
|
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 $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]. $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 mktime(hour, minute, second, month, day, year); Now what we can do is this $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
|
|
|
|
#19250 - 09/16/05 05:14 PM
Re: PHP - Replacing output format of date...
|
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 $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
|
|
|
|
#19252 - 09/16/05 07:05 PM
Re: PHP - Replacing output format of date...
|
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: <?
$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
|
|
|
|
#19254 - 09/19/05 04:30 PM
Re: PHP - Replacing output format of date...
|
Junior Member
Registered: 09/13/05
Posts: 6
Loc: Des Moines, IA
|
Oooops.... <?
$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
|
|
|
|
|
Registered: 06/09/09
Posts: 1
|
|
7030 Members
45 Forums
13867 Topics
48939 Posts
Max Online: 679 @ 09/10/09 06:08 PM
|
|
|
1 registered (Gizmo),
279
Guests and
164
Spiders online. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|