Here you can find the source of timestamp2Internal(java.sql.Timestamp t)
Parameter | Description |
---|---|
t | a parameter |
public static String timestamp2Internal(java.sql.Timestamp t)
//package com.java2s; /******************************************************************************* * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH . * 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:/*from w ww.ja v a 2 s . c om*/ * s IT Solutions AT Spardat GmbH - initial API and implementation *******************************************************************************/ public class Main { /** * Converts a Timestamp into the internal encoding as defined above. * @param t * @return non null string following the encoding defined above. * @since version_number * @author s3460 */ public static String timestamp2Internal(java.sql.Timestamp t) { if (t == null) return ""; long seconds = t.getTime() / 1000; //miliseconds lost by division int nanos = t.getNanos(); //Timestamp stores nanos in own component return String.valueOf(seconds) // integral seconds + " " + String.valueOf(nanos); // nanoseconds } }