Java Date Long Format getLongOracleDateTime(Date date)

Here you can find the source of getLongOracleDateTime(Date date)

Description

get Long Oracle Date Time

License

Open Source License

Declaration

public static synchronized Double getLongOracleDateTime(Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    static private SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
    static private SimpleDateFormat sdfMonth = new SimpleDateFormat("MM");
    static private SimpleDateFormat sdfDay = new SimpleDateFormat("dd");
    static private SimpleDateFormat sdfHours = new SimpleDateFormat("HH");
    static private SimpleDateFormat sdfMinutes = new SimpleDateFormat("mm");
    static private SimpleDateFormat sdfSeconds = new SimpleDateFormat("ss");

    public static synchronized Double getLongOracleDateTime(Date date) {
        if (date == null) {
            return Double.NaN;
        }//from w ww  .  j  av a  2s  .  c o  m
        long result = Long.parseLong(sdfYear.format(date)) * 10000000000L
                + Long.parseLong(sdfMonth.format(date)) * 100000000L
                + Long.parseLong(sdfDay.format(date)) * 1000000L + Long.parseLong(sdfHours.format(date)) * 10000L
                + Long.parseLong(sdfMinutes.format(date)) * 100L + Long.parseLong(sdfSeconds.format(date));
        return Double.valueOf(result);
    }
}

Related

  1. getLongFormatTime(java.util.Date date)
  2. getLongFromDatestamp(String datestamp)
  3. getLongGmtDateString(Date date)
  4. getLongMillis(String date)
  5. getLongNowTime()
  6. getLongPattern(final Locale locale)
  7. getLongTime()
  8. getLongWeekday(int dayOfWeek)