kalenjordan / magerun-addons

MageRun Addons
116 stars 30 forks source link

Random time #28

Open dttai1995 opened 8 years ago

dttai1995 commented 8 years ago

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 commented 8 years ago

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

Vinai commented 8 years ago

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

dttai1995 commented 8 years ago

Thanks a lot. Merci beaucoup. Muchas Gracias <3

On 17 November 2016 at 23:17, Vinai Kopp notifications@github.com 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 https://github.com/kalenjordan/magerun-addons/issues/28#issuecomment-261291669, 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 commented 8 years ago

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 dttai.ityu@gmail.com wrote:

Thanks a lot. Merci beaucoup. Muchas Gracias <3

On 17 November 2016 at 23:17, Vinai Kopp notifications@github.com 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 https://github.com/kalenjordan/magerun-addons/issues/28#issuecomment-261291669, 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