Date as Variable

  • 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 <img src="smileys/smiley12.gif" border="0" align="middle" />

  • 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..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks Keepee! I was away and will check out your cap today! Thanks again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)