Here you can find the source of getTimeStamp(final String dateTimeFormatPattern)
Parameter | Description |
---|---|
dateTimeFormatPattern | Input dateTimeFormatPattern pattern. Use DateTimeFormatter pattern conventions. |
public static String getTimeStamp(final String dateTimeFormatPattern)
//package com.java2s; /**/* w ww . ja va2s . c o m*/ * Copyright (c) 2016, German Neuroinformatics Node (G-Node) * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the BSD License. See * LICENSE file in the root of the Project. */ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Main { /** * Return time stamp formatted corresponding to input dateTimeFormatPattern pattern. * @param dateTimeFormatPattern Input dateTimeFormatPattern pattern. * Use {@link DateTimeFormatter} pattern conventions. * @return Formatted timestamp. */ public static String getTimeStamp(final String dateTimeFormatPattern) { return LocalDateTime.now().format(DateTimeFormatter.ofPattern(dateTimeFormatPattern)); } }