- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Clock tickMinutes() method in Java
The current ticking value in minutes can be obtained using the method tickMinutes() in the Clock Class in Java. This method requires a single parameter i.e. the time zone and it returns the current ticking value in minutes.
A program that demonstrates this is given as follows −
Example
import java.time.*; public class Demo { public static void main(String[] args) { ZoneId zId = ZoneId.of("Australia/Melbourne"); Clock c = Clock.tickMinutes(zId); System.out.println("The current ticking value in minutes is: " + c.instant()); } }
Output
The current ticking value in minutes is: 2019-02-06T11:00:00Z
Now let us understand the above program.
The current ticking value in minutes is obtained using the method tickMinutes(). Then the method instant() is used to print the instance of the clock. A code snippet that demonstrates this is as follows −
ZoneId zId = ZoneId.of("Australia/Melbourne"); Clock c = Clock.tickMinutes(zId); System.out.println("The current ticking value in minutes is: " + c.instant());
Advertisements