One 、 brief introduction

be used for “ Time stamp ” Arithmetic . It is a Unix First year ( Tradition Is set to UTC The time zone 1970 year 1 month 1 At midnight ) Start The description of the experience is calculated

Two 、 Document introduction

1、now

 Instant instantNow = Instant.now();
System.out.println("instant Get current yyyy-mm-dd :\n" + instantNow);
Clock clock = Clock.systemDefaultZone();
Instant instantClock = Instant.now(clock);
System.out.println("instantClock Get current yyyy-mm-dd :\n" + instantClock);
Instant localDateGet = Instant.now();
System.out.println(" from 1970-01-01T00:00:00Z Seconds to start :\n" + localDateGet.getEpochSecond());
System.out.println("localDateGet Get the current day of the month :\n" + localDateGet.atZone(ZoneId.of("GMT+8", new HashMap<>(64))));

2、ofEpochSecond

 Instant instantEpochSecond = Instant.ofEpochSecond(200);
System.out.println(" from 1970-01-01T00:00:00Z The number of seconds :\n" + instantEpochSecond);

3、ofEpochMilli

 Instant instantEpochMilli = Instant.ofEpochMilli(600);
System.out.println(" from 1970-01-01T00:00:00Z Millisecond count :\n" + instantEpochMilli);

4、from

 Instant localDateFormatNow = Instant.from(ZonedDateTime.now());
System.out.println(" The current date is :\n" + localDateFormatNow);

5、parse

 Instant instantText = Instant.parse("2007-12-03T10:15:30.00Z");
System.out.println("instantText Output string date :\n" + instantText);

6、 Maximum and minimum

 Instant instantMax = Instant.MAX;
System.out.println("instantMax The maximum value range of year :\n" + instantMax); Instant instantMin = Instant.MIN;
System.out.println("instantMin The minimum value range of a year :\n" + instantMin);

JAVA 8 Major new features ----------------( 7、 ... and ) New time date API -----Instant More about timestamps

  1. Java8 One of the new features 、 Time date API

    package com.effective.common.base.date; import java.time.Instant; import java.time.LocalDate; import ...

  2. JAVA 8 Major new features ----------------( 7、 ... and ) New time date API -----LocalDate

    One . The reason for the revision 1. Boss's Date and Calander Existing problems , The date operation name is confused , Some are text Next , Some are util Next , The package name is confused          2.Simple Package chaos , Fatal error thread is not safe .        ...

  3. JAVA 8 Major new features ----------------( 7、 ... and ) New time date API ----- Duration “ Time ” interval

    Duration: Used to calculate two “ Time ” interval brief introduction : usage : 1.Zero Constant example : Duration duration = Duration.ZERO; System.out.println(&qu ...

  4. JAVA 8 Major new features ----------------( 7、 ... and ) New time date API -----LocalDateTime

    One .LocalDateTime brief introduction Two . Practical explanation LocalDateTime localDateMax = LocalDateTime.MAX; System.out.println("lo ...

  5. Java8 New characteristics ( 3、 ... and )——Optional class 、 Interface method and new time date API

    One .Optional Container class This is a can for null The container object of . If the value exists isPresent() Method will return true, call get() Method returns the object . Looking at the structure diagram, you can see the following common methods : of(T)—— ...

  6. Java 8 New time date API

    1. summary 1.1 brief introduction Java 8 Introduced a new set of time and date API, It's easier to operate . A brief introduction ,LocalDate and LocalTime and LocalDateTime Use : java.util.Da ...

  7. java8 New characteristics —— Time date API

    Traditional time API There is a thread safety problem , In multithreading development, you have to lock , therefore java8 Now we have a new set of time and date API , Come in today and learn java8 Time and date of API. One . Use Local ...

  8. Recover one's original simplicity asp.net mvc (11) - asp.net mvc 4.0 New features from the host Web API, stay WebForm Provided in the Web API, adopt Web API Upload files , .net 4.5 More convenient asynchronous operation

    original text : Recover one's original simplicity asp.net mvc (11) - asp.net mvc 4.0 New features from the host Web API, stay WebForm Provided in the Web API, adopt Web API Upload files , ...

  9. JDK1.8 New characteristics —— Traverse the collection in a new way

    JDK1.8 New characteristics —— Traverse the collection in a new way Abstract : In this paper, we mainly study the JDK1.8 New way to traverse the collection in . Traverse List Method : default void forEach(Consumer<? su ...

Random recommendation

  1. linux screen Detailed command

    One . background System administrators often need SSH perhaps telent Remote login to Linux The server , Often run tasks that take a long time to complete , For example, system backup .ftp Transmission and so on . Usually, we are making a long way for each such task ...

  2. cocos2d-x And Use rich text control to parse xhml label ( Text label , Picture label , Line wrap label , Tag attributes )

    Effect after execution : Front end use : backstage SuperRichText analysis code void SuperRichText::renderNode(tinyxml2::XMLNode *node){ while (n ...

  3. phpcms v9 0day

    index.php?m=member&c=index&a=login suffix username=phpcms&password=123456%26username%3d%2527 ...

  4. solve ScrollView nesting ListView,ListView After filling the container , The interface automatically scrolls back to the top

    1.scrollView.scrollTo(0,0), Sometimes you can , Sometimes not : 2.listView.post(new Runnable() {                               ...

  5. memcached Learning notes 3--telnet operation memcached

    The way : One .telnet visit memcached Cache system ( Mainly for teaching , Don't discuss ) telnet 127.0.0.1 11211     => telnet IP Address Port number // Go to Memcache ...

  6. Twitter Storm: storm Some common patterns of

    This article lists storm topology Some of the common patterns : Flow aggregation (stream join) The batch (Batching) BasicBolt In memory cache + fields grouping Combine ...

  7. powerdesigner Easy to use

    ---- 1) --- New flowchart : New model , choice activity That's OK . ----

  8. C++Primer Learning notes ( Two 、 Basics )

    1. Two initialization methods , Direct initialization syntax is more flexible , And more efficient . ); // Direct initialization direct-initialization ; // Assignment initialization copy-initialization 2.const ...

  9. Windows Under the system TCP Parameter optimization

    1. TCP The state of the connection Let's first introduce TCP State during connection establishment and closing .TCP The connection process is a state transition , The factors that cause state transitions include user calls . Specific packets and timeouts, etc , The specific status is as follows : CLOSED: The initial state , ...

  10. 17、Map Interfaces and their common subclasses (Hashtable、HashMap、WeakHashMap)

    17.Map Interface Map No inheritance Collection Interface ,Map Provide key To value Mapping . One Map Cannot contain the same key, Every key Only one... Can be mapped value.Map Interface provide 3 A view of a collection of species ,Map Of ...