Java Now now()

Here you can find the source of now()

Description

now

License

Apache License

Declaration

public static String now() 

Method Source Code

//package com.java2s;
/**/*w  w w  .  j a  v a2 s  .c  om*/
 * Tern Framework.
 * 
 * @author fancimage
 * @Copyright 2010 qiao_xf@163.com Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 */

import java.util.Date;
import java.text.SimpleDateFormat;

public class Main {
    public static String now() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dt = sdf.format(new Date());
        return dt;
    }

    public static String now(String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        String dt = sdf.format(new Date());
        return dt;
    }
}

Related

  1. isNowInInterval(String start, String end)
  2. makeUniqueName(final String[] knownNames, final String pattern)
  3. now()
  4. now()
  5. now()
  6. now()
  7. now()
  8. now()
  9. now()