Java Timestamp Now currentTimeStamp()

Here you can find the source of currentTimeStamp()

Description

Generates the current timestamp.

License

Open Source License

Return

timestamp The current timestamp

Declaration

public static Timestamp currentTimeStamp() 

Method Source Code

//package com.java2s;
/*/*from   www .  j  av  a 2  s  . c  o m*/
 * This work is Open Source and licensed by the European Commission under the
 * conditions of the European Public License v1.1
 *
 * (http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1);
 *
 * any use of this file implies acceptance of the conditions of this license.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

import java.sql.Timestamp;
import java.util.GregorianCalendar;

public class Main {
    /**
     * Generates the current timestamp.
     *
     * @return timestamp The current timestamp
     */
    public static Timestamp currentTimeStamp() {
        final GregorianCalendar cal = new GregorianCalendar();
        final long millis = cal.getTimeInMillis();
        return new Timestamp(millis);
    }
}

Related

  1. currentTimeStamp()
  2. currentTimestamp()
  3. currentTimestamp()
  4. currentTimeStamp()
  5. currentTimestamp()
  6. currentTimestamp2String(String pattern)
  7. currentTimestampPlus(final long seconds)
  8. generateTimestamp()