Java Duration Format durationTranslator(String sonarDuration)

Here you can find the source of durationTranslator(String sonarDuration)

Description

duration Translator

License

Open Source License

Declaration

public static String durationTranslator(String sonarDuration) 

Method Source Code

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

public class Main {
    public static String durationTranslator(String sonarDuration) {
        String daysPart = "P"
                + (sonarDuration.contains("d") ? sonarDuration.substring(0, sonarDuration.indexOf('d')) + "D" : "");
        String timePart = (sonarDuration.contains("d") ? sonarDuration.substring(sonarDuration.indexOf('d') + 1)
                : sonarDuration);/*  www  .  j av  a 2  s  .  c  o  m*/
        return daysPart + (timePart.isEmpty() ? "" : "T" + timePart.replaceAll("min", "M").replaceAll("h", "H"));
    }
}

Related

  1. durationToString(long durationInMilliSeconds)
  2. durationToString(long durationInMillisLong)
  3. durationToString(long durationMs)
  4. durationToString(Long ms)
  5. durationToString(long x)
  6. format8601Duration(long duration)
  7. formatBuildDuration(final long duration)
  8. formatDuration(double dblSeconds)
  9. formatDuration(Duration d)