How do I separate the year from the day, month and time?

0 favourites
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • If you just set it to 'Browser.ExecJS("Date()")' you'll then see why the statement is showing text (for me, it shows 'Wed Oct 07 2015 18:25:03 GMT+0100 (GMT Standard Time)' therefore the last 4 characters are 'ime)')

    If the format of the returned date is consistant, then you could try:

    mid(Browser.ExecJS("Date()"),11,4)

    which for me shows just the yesr.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are not doing anything wrong..

    Have you looked at what the whole string is before using the right() expression?

    What you are seeing are the last 4 letters of that string..

    Everything is working like it should

  • If you just set it to 'Browser.ExecJS("Date()")' you'll then see why the statement is showing text (for me, it shows 'Wed Oct 07 2015 18:25:03 GMT+0100 (GMT Standard Time)' therefore the last 4 characters are 'ime)')

    If the format of the returned date is consistant, then you could try:

    mid(Browser.ExecJS("Date()"),11,4)

    which for me shows just the yesr.

    Thanks for this. It helps a lot.

  • You are not doing anything wrong..

    Have you looked at what the whole string is before using the right() expression?

    What you are seeing are the last 4 letters of that string..

    Everything is working like it should

    Thanks for all the help man. I get it now.

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