Date Extension

Dom818

  • *
  • Posts: 1292
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: 17524
Thanks! I recommend combining them into a single block using a dropdown if you can.

Dom818

  • *
  • Posts: 1292
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: 534
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: 1292
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: 534
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: 1960
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: 1292
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: 432
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: 1292
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.

Does this work for iOS? Is it local time or on one time zone?

Dom818

  • *
  • Posts: 1292
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).

Vectrex71

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

Dom818

  • *
  • Posts: 1292
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.

Vectrex71

  • Posts: 534

« Last Edit: October 15, 2012, 09:26:25 am by Vectrex71 »