Escape characters in date()

Hi Guys!

I need to escape a character in date(). Please see example below:

echo date("M j, Y \\\\a\	 G:i", $vars['lastlogin']);

The output is

Jan 5, 2011 a 15:09

I need it to say “at” like this:

Jan 5, 2011 at 15:09

Any idea how to fix this?


echo date('M j, Y \\a\	 G:i', $vars['lastlogin']);  

Ahhh the single quotes :slight_smile:

Thanks!!

You were almost there with the double-quoted string, the slash has to be escaped again since otherwise it is interpreted as \ which is the horizontal tab character.

echo date("M j, Y \\a\\\	 G:i", $vars['lastlogin']);

See example #2 on http://php.net/date