Stencyl 3.4.0 is now out. Get it now!

Date Extension

Dom818

  • *
  • Posts: 1296
This adds Date and Time functions to Stencyl.

The Blocks
-Get Current Date: Gets the current date and time in the YYYY-MM-DD HH-MM-SS format. This returns a piece of text.
-Get Current Timestamp: Gets the current date's timestamp
-Get Current [year/month/day of the month/day of the week/hour/minute/second]: Gets the current aspect of the date.
-Get [year/month/day of the month/day of the week/hour/minute/second] using timestamp (number): Gets a certain aspect of the date using the given timestamp.
-Get Days in Month from Year: Get the number of days in a month during a year that you specify.
-Convert (number) milliseconds to [second/minute/hour/day]:

This extension works on all of Stencyl's platforms.
Code: [Select]
Changelog:
1.4
-Added three new blocks (timestamp operations, conversions)
1.3.2
-Updated help website
1.3.1
-Fixed the newly added block
1.3
-Added the "get days in month" block
1.2
-Block text converted to lowercase
1.1
-Combined the blocks
1.0
-Initial release

« Last Edit: May 13, 2015, 08:12:35 pm by Irock »

Jon

  • *
  • Posts: 17502
Thanks! I recommend combining them into a single block using a dropdown if you can.

Dom818

  • *
  • Posts: 1296
I combined all of the blocks into just two blocks now. I left the block that gets the full date separate because it returns a different type than the others. It is posted above.

Vectrex71

  • Posts: 518
I'm sorry, but may i ask you for a short example ? i installed the extension but now i can't see how i can make a clock (iOS/Android)

Thanks !!


Dom818

  • *
  • Posts: 1296
I'm sorry, but may i ask you for a short example ? i installed the extension but now i can't see how i can make a clock (iOS/Android)

Thanks !!

What kind of example would you like for a clock? What exactly do you want the example to show?

Vectrex71

  • Posts: 518
Hello DOM818 ! Thanks for your time !

I just need to know, how i can use the new blocks !

How can i SHOW the DATE and TIME ?

i know, the first one, returns TEXT, the second block returns a NUMBER , but how can i show it ?


EDIT:

i found something in the HELP section!

http://www.stencyl.com/help/view/mobile-text/


 




Innes

  • *
  • Posts: 1963
Thanks for creating this extension Dom. I put together a (quick and dirty) clock in under 5 minutes - screenshot attached.
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

Dom818

  • *
  • Posts: 1296
Thanks for creating this extension Dom. I put together a (quick and dirty) clock in under 5 minutes - screenshot attached.

That's cool Innes! Glad you like the extension. :)

JensWinterstein

  • *
  • Posts: 433
Thanks a lot for sharing, Dom818.
Very nice extension.
Get 100 Chambers for Android / iOS
Get Cubus Velox for Android / iOS or play it on Flash

- Portfolio

Dom818

  • *
  • Posts: 1296
Small update which changes the help link for the blocks. You are now sent to a custom part of my website with information on the blocks.

The updated extension is available in the first post.

Stevetheipad

  • Posts: 1304
Does this work for iOS? Is it local time or on one time zone?

Dom818

  • *
  • Posts: 1296
Does this work for iOS? Is it local time or on one time zone?

Yep, this will work on all of the platforms Stencyl exports to. I actually don't know if it is local time or one time zone. When I tested it, it gave the time for the time zone I was in (Eastern Standard Time).

RENGAC

  • *
  • Posts: 335
Does this work for iOS? Is it local time or on one time zone?
I think that the time you get is the time specified by the machine, so if your platform has a wrong time /date, you´ll get a bad time /date. If you are using local time, you´ll get local time.

Vectrex71

  • Posts: 518
Maybe i'm to dumb for that, but i can't show the time with this extension :-(

Dom818

  • *
  • Posts: 1296
Maybe i'm to dumb for that, but i can't show the time with this extension :-(

I believe the simplest way is to combine the pieces of the date you want with the join text blocks and stick that into a draw text block. That will constantly update the time every frame. I can take a quick picture of this when I get home.