pocobueno1388 Posted October 29, 2006 Share Posted October 29, 2006 Hello everyone. I was just wondering how I would take a timestamp from the database like this: 16:48:11and change it to central time (US). I have played with the date() function, but I couldn't figure it out. I also don't want it to appear in military time.I appreciate all your help ^^ Thanks. Link to comment https://forums.phpfreaks.com/topic/25447-changing-the-time-from-the-database/ Share on other sites More sharing options...
pendelton Posted October 29, 2006 Share Posted October 29, 2006 date("h:i:s");Use putenv("TZ=GB"); to set your timezone (you will need to replace GB with UST or similar). Link to comment https://forums.phpfreaks.com/topic/25447-changing-the-time-from-the-database/#findComment-116125 Share on other sites More sharing options...
pocobueno1388 Posted October 29, 2006 Author Share Posted October 29, 2006 I'm sorry, I don't understand the second part of what you said 0_0 Link to comment https://forums.phpfreaks.com/topic/25447-changing-the-time-from-the-database/#findComment-116126 Share on other sites More sharing options...
pendelton Posted October 29, 2006 Share Posted October 29, 2006 I assume that the timezone on you machine is not central time US? If it is then you don't need the putenv. However, the server isn't using central US time you will need to write to code as follows:Use [code]<?putenv("TZ=US");print date("h:i:s");?>[/code]Try the above then chage "TZ=US" to "TZ=GB" (TZ stands for timezone). Link to comment https://forums.phpfreaks.com/topic/25447-changing-the-time-from-the-database/#findComment-116205 Share on other sites More sharing options...
pocobueno1388 Posted October 29, 2006 Author Share Posted October 29, 2006 That printed the time out as 3:00 when it was 9:00....so it didn't work. I tried this too:[code]<?putenv("TZ=US/central");print date("h:i:s");?>[/code] Link to comment https://forums.phpfreaks.com/topic/25447-changing-the-time-from-the-database/#findComment-116286 Share on other sites More sharing options...
pocobueno1388 Posted October 29, 2006 Author Share Posted October 29, 2006 Anyone else have any ideas? Link to comment https://forums.phpfreaks.com/topic/25447-changing-the-time-from-the-database/#findComment-116469 Share on other sites More sharing options...
pocobueno1388 Posted October 30, 2006 Author Share Posted October 30, 2006 Hmmm...no one? Link to comment https://forums.phpfreaks.com/topic/25447-changing-the-time-from-the-database/#findComment-116539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.