Here you can find the source of timestampToUTC(Timestamp marcTimestamp)
Parameter | Description |
---|---|
marcTimestamp | The Timestamp object |
public static String timestampToUTC(Timestamp marcTimestamp)
//package com.java2s; /**// www . j a v a 2 s .c om * Copyright (c) 2009 University of Rochester * * This program is free software; you can redistribute it and/or modify it under the terms of the MIT/X11 license. The text of the * license can be found at http://www.opensource.org/licenses/mit-license.php and copy of the license can be found on the project * website http://www.extensiblecatalog.org/. * */ import java.sql.Timestamp; import java.text.SimpleDateFormat; public class Main { /** * Convert a java.sql.Timestamp object (come from the database) to * string in UTCdatetime format "yyyy-MM-dd'T'HH:mm:ssZ" format * @param marcTimestamp The Timestamp object * @return The string value */ public static String timestampToUTC(Timestamp marcTimestamp) { if (null == marcTimestamp) { return "no timestamp"; } else { return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(marcTimestamp); } } }