dick220369 Posted January 8, 2009 Share Posted January 8, 2009 i want to use php to display the session start time server side and the session start time client side. the displays are static and only need to display the times at session start. i dont want the date to appear only the times for client and server side. i've searched the web to no avail and seriously contemplating smashing up my computer in frustration please help Quote Link to comment https://forums.phpfreaks.com/topic/140027-display-times/ Share on other sites More sharing options...
premiso Posted January 8, 2009 Share Posted January 8, 2009 In order to do the client side you either, a need to use javascript to grab their timezone, or b have the user specify their timezone. PHP does not interact with the client other than providing them displayed data. Quote Link to comment https://forums.phpfreaks.com/topic/140027-display-times/#findComment-732599 Share on other sites More sharing options...
Brian W Posted January 8, 2009 Share Posted January 8, 2009 What do you mean by the start time client side? What are u using this for? date formats for only time could look like this date('H:i:s') will return 00-23:00-59:00-59 and date('h:i:s A') will return 00-12:00-59:00-59 AM-PM sorry if you already knew that Quote Link to comment https://forums.phpfreaks.com/topic/140027-display-times/#findComment-732604 Share on other sites More sharing options...
dick220369 Posted January 8, 2009 Author Share Posted January 8, 2009 i have to do this as part of an assignment for uni. i thought i may have to use javascript to display the client side time and know how to do this. i make sure that a session starts when my page loads using <?php session_start();?> at the top of my page. the assignment requires me to display on the web page the time the session started server side in a format like 23:10. thanks for any advice given in advance. Quote Link to comment https://forums.phpfreaks.com/topic/140027-display-times/#findComment-732615 Share on other sites More sharing options...
premiso Posted January 8, 2009 Share Posted January 8, 2009 date would be all that you need. <?php session_start(); echo 'Session started at ' . date('H:i'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/140027-display-times/#findComment-732622 Share on other sites More sharing options...
dick220369 Posted January 8, 2009 Author Share Posted January 8, 2009 thanks very much for responses, finally got it working hopefully you can help me with another problem. i have a form that is displayed when the page is first submitted but need the form to disappear when the data is submitted. the page is self referencing any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/140027-display-times/#findComment-732630 Share on other sites More sharing options...
premiso Posted January 8, 2009 Share Posted January 8, 2009 Either IF-Logic or put the form in a <div and use javascript to hide it depending on your needs. <?php if (isset($_POST['submit'])) { // do form processing }else { // display the form. } ?> That would be a sample if logic. Given that your submit button name is "submit". Quote Link to comment https://forums.phpfreaks.com/topic/140027-display-times/#findComment-732636 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.