Date as Variable

Get help using Construct 2

Post » Mon Oct 29, 2012 3:29 am

Trying to find an efficient way to have the user enter a date to a text object in 00/00/00 format and have that be a variable that I can work with to add or subtract from to show a new date in 00/00/00 format.

I remember a long time ago reading about this process and that it would involve (I can't recall the process) but parsing? or something where it would read the date as a single variable chain? I'm not a programmer so I may be speaking gibberish and using invalid terms so I apologize :)

Patience appreciated
B
16
S
2
G
5
Posts: 30
Reputation: 3,925

Post » Mon Oct 29, 2012 11:59 am

You could do it with one variable, but I think you'd end up with very long and awkward expressions to cater for stuff like the varying amount of days in each month, and the way we write months and dates starting with 1st instead of 0th..

It'll be much less of a headache if you use seperate vars for Date/Month/Year.
Plus, you can create the Date string where it's needed afterwards just by using set text to Date&"/"&Month&"/"&Year

expressions you'll need are:
tokenat() I think this is what you were referring to with parsing..
int() converts a string into an integer
% Operator
you'll find good explanations of each in the manual


*edit: I made a cap anyway
It's a little confusing at the bottom so if you have any questions.. keepee2012-10-29 12:26:51
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sun Nov 04, 2012 6:44 pm

Thanks Keepee! I was away and will check out your cap today! Thanks again!
B
16
S
2
G
5
Posts: 30
Reputation: 3,925


Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Zebbi and 20 guests