Java Date Format Change convertIso8601FormatToArsTime(String timeString)

Here you can find the source of convertIso8601FormatToArsTime(String timeString)

Description

Converts a string in ISO8601 Format into the string corresponding to an Ars internal time representation

License

BSD License

Declaration

public static String convertIso8601FormatToArsTime(String timeString) throws ParseException 

Method Source Code

//package com.java2s;
//License from project: BSD License 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static final SimpleDateFormat iso8601DateTimeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

    /** Converts a string in ISO8601 Format into the string corresponding to an Ars internal time representation */
    public static String convertIso8601FormatToArsTime(String timeString) throws ParseException {
        Date date = iso8601DateTimeFormatter.parse(timeString);
        int secondsSinceEpoch = (int) (date.getTime() / 1000);
        return String.valueOf(secondsSinceEpoch);
    }// ww  w  .j a  v a2 s .  c o m
}

Related

  1. convertDateFromInDayFormat(String stringDate, String hhmmss)
  2. convertDateFromTo(String stringDate, String patternToUse, TimeZone timezoneIn, TimeZone timezoneOut)
  3. convertDateStringToString(String dateString, String format)
  4. convertDateStringToString(String strDate, String currentFormat, String parseFormat)
  5. convertDatetimeFormat(Date tar_date, String date_format)
  6. convertIso8601FormatToArsTimeOfDay(String timeOfDayString)
  7. convertISO8610ToCalendar(String iso8601string)
  8. convertTimeStringToTimestamp(String timeString, String timeFormat)