realcoder Posted July 6, 2010 Share Posted July 6, 2010 i want to get ime of login is there any exact function thorugh that i can get exact time & put in database i have see a function time() but it's not ruturning the right format ..please tell me how i get exact time thanks Quote Link to comment https://forums.phpfreaks.com/topic/206876-how-to-get-time/ Share on other sites More sharing options...
bh Posted July 6, 2010 Share Posted July 6, 2010 Hi, time() is an Unix timestamp. You can create a formatted date from time() -> date('Y-m-d', time()) Quote Link to comment https://forums.phpfreaks.com/topic/206876-how-to-get-time/#findComment-1081838 Share on other sites More sharing options...
trq Posted July 6, 2010 Share Posted July 6, 2010 You might want to take a look at date. Quote Link to comment https://forums.phpfreaks.com/topic/206876-how-to-get-time/#findComment-1081839 Share on other sites More sharing options...
Pikachu2000 Posted July 6, 2010 Share Posted July 6, 2010 If I'm reading your post correctly, you want the current timestamp in the database.? If that's true, you can use a field with the DATETIME data type, then set 'field = NOW()' in the query. Quote Link to comment https://forums.phpfreaks.com/topic/206876-how-to-get-time/#findComment-1081907 Share on other sites More sharing options...
premiso Posted July 6, 2010 Share Posted July 6, 2010 If you are putting this into MySQL, you can have the column type be TIMESTAMP or DATETIME and just use the NOW() function, better to handle the time inside the database and save yourself the hassle of doing it in both places, imo. Quote Link to comment https://forums.phpfreaks.com/topic/206876-how-to-get-time/#findComment-1081913 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.