From: PartyPosters [mailto:sales@xxxxxxxxxxxxxxxxxx] > Hello, > I have a variable that contains a filename, I want to be able > to insert the date and time just before for the ".jpg" > for example if my filename is 'pic.jpg' I want it to read > 'pic_Monday 15th of January 2003 05:51:38 AM.jpg (or if > anyone else knowshow to write the time and time all in > numbers it would be appreciated as I'm using ate("l dS of F Y > h:i:s A") which obviously is a bit long. First off, I'd probably use preg_replace(). Maybe something like: $pattern = '/^(.*?)(\.jpg)$/'; $replacement = '\1' . date('l dS of F Y h:i:s A') . '\2'; $filename = preg_replace($pattern, $replacement, $filename); I haven't tested that, but I think it should work. As for the date format, if it doesn't need to be human-readable, might I suggest date('U')? It's the number of seconds since the epoch; it's easily convertable to human-readable format. If that doesn't fly, perhaps MySQL's datetime format, which is a 14-digit int, achievable with date('YmdHis'). I may be a holdover from DOS, but I shudder at spaces in filenames. :) HTH! -- Mike Johnson Smarter Living, Inc. Web Developer www.smartertravel.com mike@xxxxxxxxxxxxxxxxx (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php