www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Replace a recurring character by another in MySQL output

  1. #1
    Join Date
    Aug 2004
    Location
    Switzerland
    Posts
    1,101

    resolved [RESOLVED] Replace a recurring character by another in MySQL output

    Hi!
    I have a quick question. I'm sure it's not especially hard to solve, but I don't know where to start. I know how to do it in actionscript, but no idea how to do it in flash.

    I'm getting a string which looks like that :
    2010-03-31 11:32:45
    And I need to transform it so that I get :
    2010/03/31
    (I know how to truncate to get only 2010-03-31)
    Replacing one character is no problem, but I don't know how to replace both "-" by "/".
    Do I have to explode the string first ?
    Thanks !

  2. #2
    Join Date
    Aug 2004
    Location
    Switzerland
    Posts
    1,101
    Oh, drop it, I found the solution. I had no idea php and actionscript where that similar.
    If it can be of any use to somebody, here is the script :

    PHP Code:
    while($line mysql_fetch_assoc($result2)) {
    $date=substr($line["post_dt"], 010);
    $datecomp=split("-"$date);
    $datestring=$datecomp[0]."/".$datecomp[1]."/".$datecomp[2];
    echo 
    $datestring;


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles