Languages
[Edit]
EN

TypeScript - get current time

0 points
Created by:
evangeline
420

In TypeScript Date class is useful to get current time.

Quick solution:

 

1. Predefined methods example

Edit

Note: during using to...String methods it is necessaryto be careful because of specific formatting of data and time on the locale.

3. Custom formatting

Edit

3.1. Example 1

Edit

renderNumber method can be replaced with built-in padStart method.

3.1. Example 2

Edit
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join