Time and/or Date to show up in app in code studio

Is there a way in Code Studio to display the current time and/or date? For example an on onEvent that takes the user to a new page where the current time and/or date would display?

@timothy.walljasper there’s no blocks for getting you the current local time and date but check out the getTime() block here to at least get the Unix Time Stamp in milliseconds.

Hopefully that helps a little!

Do you have any code for converting milliseconds to the current date or current time? I have students who want to display both for an app they are creating. I can probably figure out how to the the millisecond-to-date conversion, but would much rather re-use existing code.

Also, can we request a getCurrentTime() and getCurrentDate() function in future releases?

1 Like

Hi @sconyers,

Great question! I will share that request with code.org staff, but I recommend contacting support@code.org with your request to get it on the list!

Great idea!
KT

Hello @sconyers I have a little app here that may show you how to get done what you’d like to do: https://studio.code.org/projects/applab/hyTOU0j43dPoKuRDgy-I_31r6b5Vc5ji-bajSvYqqoo/view

Cheers!
~ Hannah

1 Like