Here you can find the source of formatTimestampToIndex(java.sql.Timestamp timestamp)
Parameter | Description |
---|---|
timestamp | Timestamp value representation |
public static String formatTimestampToIndex(java.sql.Timestamp timestamp)
//package com.java2s; /*// www .j av a2 s.c o m * @(#)TextUtility.java * * Copyright (c) 2003 DCIVision Ltd * All rights reserved. * * This software is the confidential and proprietary information of DCIVision * Ltd ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the license * agreement you entered into with DCIVision Ltd. */ import java.text.SimpleDateFormat; public class Main { /** * formatTimestampToIndex * * Call this function to format a java.sql.Timestamp into a String * with format "yyyyMMddhhmmss" for lucene indexing * * @param timestamp Timestamp value representation * @return String The String format after convertion */ public static String formatTimestampToIndex(java.sql.Timestamp timestamp) { if (timestamp == null) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss", java.util.Locale.US); String dateStr = sdf.format(timestamp); return dateStr; } }