kalenjordan/magerun-addons

Random time

dttai1995 opened this issue · 4 comments

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.

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

Vinai commented

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

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
#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

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
#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