Current location: Hot Scripts Forums » Programming Languages » PHP » help with converting string ..

help with converting string ..

Reply
  #1 (permalink)  
Old
Newbie Coder
 
Join Date: Nov 2007
Posts: 99
Thanks: 9
Thanked 0 Times in 0 Posts
Question help with converting string ..

Hi im a php newbie

i have this code

PHP Code:

<?

$noic 
"811009-xx-xxxx";
$ex explode('-',$noic);
$sp str_split($ex[0]);

$year $sp[0].$sp[1];
$month $sp[2].$sp[3];
$day $sp[4].$sp[5];

echo 
$day.'-'.$month.'-'.$year;

?>

it will change noic = 811009-xx-xxxx to date 09-10-81

what if my noic is in this format 811009xxxxxx

how do i do this..

TQ
Reply With Quote

Featured Marketplace Scripts (view more)

  #2 (permalink)  
Old
Newbie Coder
 
Join Date: Nov 2007
Posts: 99
Thanks: 9
Thanked 0 Times in 0 Posts
PHP Code:

 <?php
    $noic 
"811009-xx-xxxx"
    
$sp substr($noic06); 

    
$year $sp[0].$sp[1]; 
    
$month $sp[2].$sp[3]; 
    
$day $sp[4].$sp[5]; 

    echo 
$day.'-'.$month.'-'.$year;
?>
solved it..from another forum

TQ..
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone explain this to me? phphelpme PHP 3 09-11-11 02:25 PM
OOP C-Sharp DB Access Wrapper Question digioz ASP.NET 1 09-08-08 10:54 AM
search function using dot net nishudude_13 Windows .NET Programming 1 08-28-08 12:28 PM
Declared Functions skipper23 PHP 4 12-17-03 11:06 AM
index page not showing up skipper23 PHP 3 12-15-03 02:10 PM


All times are GMT -5. The time now is 01:40 PM.
vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.