vmicchia Posted February 22, 2011 Share Posted February 22, 2011 I'm not sure if this is the right form I may need to put this in the mySQL forum so apologies if it's in the wrong place. I would however like to do this in php. What I need to do is set up a counter that resets every day at midnight. So it would start with 01 and count up till 12:00AM server time and then reset to 01 for the next day. This is for an ordering system to add a number to the end of any order. Any help is much appreciated. I know it's not much info but I'm not even sure where to begin such a thing. Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted February 22, 2011 Share Posted February 22, 2011 use microtime() - it's a built-in function of PHP that gives you the number of seconds + milleseconds since the UNIX Epoch (1st January 1970) according to the server time. you can use time() for just the seconds but in case someone orders something on the same second you will want microtime to differentiate between the two orders. Although usually you would implement your own unique numbering system. hope this helps Quote Link to comment Share on other sites More sharing options...
vmicchia Posted February 23, 2011 Author Share Posted February 23, 2011 That helps very much thank you. It is a unique numbering system this is just for the end. This is a bit different than I was thinking but I think it will work. Quote Link to comment Share on other sites More sharing options...
codefossa Posted February 23, 2011 Share Posted February 23, 2011 From what I take from this, you may be wanting date('H:i:s'), which would give you the time of the day according to the server. Example output of "echo date('H:i:s');" would be 16:04:32 (4:04 pm for those of you that can't read 24-hour) Quote Link to comment 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.