Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random time #28

Open
dttai1995 opened this issue Nov 17, 2016 · 4 comments
Open

Random time #28

dttai1995 opened this issue Nov 17, 2016 · 4 comments

Comments

@dttai1995
Copy link

dttai1995 commented Nov 17, 2016

It seems that your algorithm doesn't create the random time for order creation. It just random the day, but the hour is a fixed number.
I suggest that in the function createAt .... you rand the time instead of the day, so it can random the time for us to use.
I'm currently work on a project that need this feature so much. By the way, thank you for you contribution.,
Wish you all the best.

@kalenjordan
Copy link
Owner

Hm seems reasonable....don't have much time to manage this repo right now. :/

@Vinai
Copy link

Vinai commented Nov 17, 2016

Hm, $createdAtTimestamp = mt_rand(time() - 356 * 2, time()) should do the trick.

@dttai1995
Copy link
Author

Thanks a lot.
Merci beaucoup.
Muchas Gracias <3

On 17 November 2016 at 23:17, Vinai Kopp [email protected] wrote:

Hm, $createdAtTimestamp = mt_rand(time() - 356 * 2, time()) should do the
trick.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#28 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/APJ3oHpL-D9xhlwxzU3YuUwiejLGGm-Vks5q_H4GgaJpZM4K077i
.

Mr. Đinh Thanh Tài
Undergraduate Student
International University, Vietnam National University - Ho Chi Minh City
Student of Department of Computer Science and Engineering
Major: Computer Science

Former Secretary of IU IT Youth Union

Phone number: +84 934331161

@dttai1995
Copy link
Author

I have tried to change your source code, and it works for now.
Edit it in case you need it:

$randomTimeAgo = rand(1, 24 * 60 * 60); //No 2 years anymore, just 1 day
but a lot of different hours
$createdAtTimestamp = time() - $randomTimeAgo;
$createdAtString = date('Y-m-d H:i:s', $createdAtTimestamp); //H:i:s for
the hour minute second

On 18 November 2016 at 13:47, Đinh Tài [email protected] wrote:

Thanks a lot.
Merci beaucoup.
Muchas Gracias <3

On 17 November 2016 at 23:17, Vinai Kopp [email protected] wrote:

Hm, $createdAtTimestamp = mt_rand(time() - 356 * 2, time()) should do
the trick.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#28 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/APJ3oHpL-D9xhlwxzU3YuUwiejLGGm-Vks5q_H4GgaJpZM4K077i
.

Mr. Đinh Thanh Tài
Undergraduate Student
International University, Vietnam National University - Ho Chi Minh City
Student of Department of Computer Science and Engineering
Major: Computer Science

Former Secretary of IU IT Youth Union


Phone number: +84 934331161

Mr. Đinh Thanh Tài
Undergraduate Student
International University, Vietnam National University - Ho Chi Minh City
Student of Department of Computer Science and Engineering
Major: Computer Science

Former Secretary of IU IT Youth Union

Phone number: +84 934331161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants