By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

Increment a number(upto 4 digit ) and reset counter on the next day

soumyadeep
P: 3
Hello everyone How are you all ?

I am developing a wordpress plugin and I need to generate a four(4) digit number starting from 0001 to 9999.
And reset the counter after 24hr or next day then continue as it was.

I am looking for a function which solve this problem.

example output :

date 27.1.2012 + (0001-9999)

Thanks in advance.
Jan 26 '12 #1
Share this Question
Share on Google+
5 Replies


Dormilich
Expert Mod 5K+
P: 8,639
for generating a random number you can use mt_rand().
Jan 26 '12 #2

soumyadeep
P: 3
Thanks Dormilich, but that doesn't solve my problem ...
Jan 27 '12 #3

Dormilich
Expert Mod 5K+
P: 8,639
but it should.
Jan 27 '12 #4

soumyadeep
P: 3
It shouldn't , because I want auto incremented number within given range not any random number.
Jan 27 '12 #5

Dormilich
Expert Mod 5K+
P: 8,639
that part is new information. then you only need to save the last used number somewhere.
Jan 27 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.