dsaba Posted April 7, 2007 Share Posted April 7, 2007 i'm using the date() function I need to know how to set the timezone to London, UK which is GMT +1 hour IN PHP 4 also I need to know how to escape characters in the date() function characters that need escaping are: "/" and ":" I tried \/ backslashing to escape but didn't work right now i'm making seperate values for each part of my date, and concacting them it would be easier for me to use the date function like: date(m/d/y:h) ...etc.... but i would need to know how to properly escape those characters here's my code: $month = date(m); $day = date(d); $year = date(Y); $hour = date(h); $minute = date(i); echo $day.'/'.$month.'/'.$year.':'.$hour.':'.$minute; //displays like: 07/04/2007:03:03 -thank you, I am confused after reading the php manual Quote Link to comment https://forums.phpfreaks.com/topic/45969-solved-escaping-characters-in-date-function-setting-timezone-help/ Share on other sites More sharing options...
Eugene Posted April 7, 2007 Share Posted April 7, 2007 have you tried putting everything in quotes? For example: date("m/d/Y:h:i"); Quote Link to comment https://forums.phpfreaks.com/topic/45969-solved-escaping-characters-in-date-function-setting-timezone-help/#findComment-223340 Share on other sites More sharing options...
dsaba Posted April 7, 2007 Author Share Posted April 7, 2007 ya that works! thanks eugene I still need to know how to set that timezone though in PHP 4 the php manual has a method but it says its for PHP 5 only anyone know how? Quote Link to comment https://forums.phpfreaks.com/topic/45969-solved-escaping-characters-in-date-function-setting-timezone-help/#findComment-223341 Share on other sites More sharing options...
dsaba Posted April 7, 2007 Author Share Posted April 7, 2007 well it turns out u CANNOT set a default timezone in ur script with php 4 unless u do it in your .ini file however i coded a workaround to convert my timezone to the one I want Quote Link to comment https://forums.phpfreaks.com/topic/45969-solved-escaping-characters-in-date-function-setting-timezone-help/#findComment-223354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.