Here you can find the source of timestampToString(Timestamp ts)
Parameter | Description |
---|---|
ts | timestamp |
public static String timestampToString(Timestamp ts)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012-2015 INRIA.//from w w w . j a v a2s . c om * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Generoso Pagano - initial API and implementation ******************************************************************************/ import java.sql.Timestamp; public class Main { /** * Conversion setting to 0 the nanoseconds, * to deal with the mysql driver bug affecting * the reverse translation (see stringToTimestamp()). * * @param ts timestamp * @return the string */ public static String timestampToString(Timestamp ts) { ts.setNanos(0); return ts.toString(); } }