Hi all!
If I have a player enter a date in the form of mm/dd/yyyy is there an easy way to convert it to a ydate?
-Thomas [import]uid: 90818 topic_id: 33089 reply_id: 333089[/import]
Hi all!
If I have a player enter a date in the form of mm/dd/yyyy is there an easy way to convert it to a ydate?
-Thomas [import]uid: 90818 topic_id: 33089 reply_id: 333089[/import]
Hello,
Lua’s various string manipulation and matching functions should help you achieve this. If that’s too general an answer, I’d have to see the code in question and the exact format you’re aiming for.
http://docs.coronalabs.com/api/library/string/index.html
Brent [import]uid: 9747 topic_id: 33089 reply_id: 131437[/import]
Hi Brent, thanks for the reply.
Basically I’ve collected a date using the widget.newPickerWheel so I have a string that says May 25, 2012. What I would like to do is see if there is an way to find the day of the year that May 25, 2012 lands on. I have found that collecting the yDay using os.time makes it very handy to figure out how many days have passed. If I can find the yDay without manually counting the months the past prior to May then adding 25 it would make it a little easier for me.
Does that make sence? [import]uid: 90818 topic_id: 33089 reply_id: 131438[/import]
Would os.date() do the trick? I haven’t used it (well maybe, can’t remember, certainly not much if I have)… but it looks like you can parse out the day of the week or basically anything else you need using the system date.
http://docs.coronalabs.com/api/library/os/date.html
Brent [import]uid: 9747 topic_id: 33089 reply_id: 131446[/import]
I use os.date() to get today’s information and it works great. But any idea on how to use it on date that has already passed? [import]uid: 90818 topic_id: 33089 reply_id: 131447[/import]
As far as I know, no. 
You’re probably stuck building some “calendar” lookup in Lua, as in, some arrangement of nested tables in which you could manually put in MMDDYY data for the range you need. Maybe you’d just need the number of days in each month going backward, and you could cross-reference it using OS.date(), then count backwards/forwards using a clever loop and figure out the new day.
Brent [import]uid: 9747 topic_id: 33089 reply_id: 131449[/import]
Ah, ok thanks. I’ll see what I can do! [import]uid: 90818 topic_id: 33089 reply_id: 131450[/import]
Hello,
Lua’s various string manipulation and matching functions should help you achieve this. If that’s too general an answer, I’d have to see the code in question and the exact format you’re aiming for.
http://docs.coronalabs.com/api/library/string/index.html
Brent [import]uid: 9747 topic_id: 33089 reply_id: 131437[/import]
Hi Brent, thanks for the reply.
Basically I’ve collected a date using the widget.newPickerWheel so I have a string that says May 25, 2012. What I would like to do is see if there is an way to find the day of the year that May 25, 2012 lands on. I have found that collecting the yDay using os.time makes it very handy to figure out how many days have passed. If I can find the yDay without manually counting the months the past prior to May then adding 25 it would make it a little easier for me.
Does that make sence? [import]uid: 90818 topic_id: 33089 reply_id: 131438[/import]
Would os.date() do the trick? I haven’t used it (well maybe, can’t remember, certainly not much if I have)… but it looks like you can parse out the day of the week or basically anything else you need using the system date.
http://docs.coronalabs.com/api/library/os/date.html
Brent [import]uid: 9747 topic_id: 33089 reply_id: 131446[/import]
I use os.date() to get today’s information and it works great. But any idea on how to use it on date that has already passed? [import]uid: 90818 topic_id: 33089 reply_id: 131447[/import]
As far as I know, no. 
You’re probably stuck building some “calendar” lookup in Lua, as in, some arrangement of nested tables in which you could manually put in MMDDYY data for the range you need. Maybe you’d just need the number of days in each month going backward, and you could cross-reference it using OS.date(), then count backwards/forwards using a clever loop and figure out the new day.
Brent [import]uid: 9747 topic_id: 33089 reply_id: 131449[/import]
Ah, ok thanks. I’ll see what I can do! [import]uid: 90818 topic_id: 33089 reply_id: 131450[/import]