As can be found on the English Wikipedia’s article about ISO 8601 (Date and time — Representations for information interchange):

  • P is the duration designator (for period) placed at the start of the duration representation.
    • Y is the year designator that follows the value for the number of years.
    • M is the month designator that follows the value for the number of months.
    • W is the week designator that follows the value for the number of weeks.
    • D is the day designator that follows the value for the number of days.
  • T is the time designator that precedes the time components of the representation.

So P means 'Period', and because there are no 'date'-components. It only has a 'time'.

You could interpret this as 'Period of Time'.

The 'why' this was chosen, you have to ask the ISO members that wrote the standard, but my guess is that it is easier to parse (short and unambiguous).

The details for the time component are:

  • H is the hour designator that follows the value for the number of hours.
  • M is the minute designator that follows the value for the number of minutes.
  • S is the second designator that follows the value for the number of seconds.

The value of PT20S then parses to:

  • Period
  • Time
  • 20
  • Seconds.

So, a duration of 20 seconds.

More examples can be found in the Java 25 documentation.

Addendum: Wikipedia gives a reason for T:

To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value).

Answer from Rob Audenaerde on Stack Overflow
Top answer
1 of 3
184

As can be found on the English Wikipedia’s article about ISO 8601 (Date and time — Representations for information interchange):

  • P is the duration designator (for period) placed at the start of the duration representation.
    • Y is the year designator that follows the value for the number of years.
    • M is the month designator that follows the value for the number of months.
    • W is the week designator that follows the value for the number of weeks.
    • D is the day designator that follows the value for the number of days.
  • T is the time designator that precedes the time components of the representation.

So P means 'Period', and because there are no 'date'-components. It only has a 'time'.

You could interpret this as 'Period of Time'.

The 'why' this was chosen, you have to ask the ISO members that wrote the standard, but my guess is that it is easier to parse (short and unambiguous).

The details for the time component are:

  • H is the hour designator that follows the value for the number of hours.
  • M is the minute designator that follows the value for the number of minutes.
  • S is the second designator that follows the value for the number of seconds.

The value of PT20S then parses to:

  • Period
  • Time
  • 20
  • Seconds.

So, a duration of 20 seconds.

More examples can be found in the Java 25 documentation.

Addendum: Wikipedia gives a reason for T:

To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value).

2 of 3
22

Java has taken a subset of the ISO 8601 standard format for a duration. So the “why” is why the standard was written the way it is, and it’s a guessing game. My go is:

  • P for period was chosen so that you can distinguish a duration from a date and/or time. Especially since a period may also be written in the same format as a local date-time, for example P0003-06-04T12:30:05 for 3 years 6 months 4 days 12 hours 30 minutes 5 seconds, the P can be necessary to distinguish. The P also gives a little but quick and convenient bit of validation in case you happen to pass a completely different string in a place where a duration was expected. And yes, PT10S looks weird, but once you get accustomed to it, you recognize it immediately as a duration, which can be practical.
  • T for time between the date part and the time part was chosen for two reasons:
    • For consistency with date-time strings that have T in the same place, for example 2018-07-04T15:00 for July 4, 2018 at 15:00 hours.
    • To disambiguate the otherwise ambiguous M for either months or minutes: P3M unambiguously means 3 months while PT3M means 3 minutes.
Discussions

Add a Double variable representing minute into a Date in Java - Stack Overflow
You can generate a String representation of the Duration in standard ISO 8601 format such as PT8H6M12.345S by merely calling toString. More on stackoverflow.com
🌐 stackoverflow.com
September 14, 2016
Conversion of milliseconds duration to ISO 8601 precise string format for duration in Java - Stack Overflow
A string representation of this duration using ISO-8601 seconds based representation, such as PT8H6M12.345S. More on stackoverflow.com
🌐 stackoverflow.com
My Quest for 345s
I'm looking at getting michelin pilot sport 4S 345/30ZR20 in the rear of my 2016 GT. 11" wheels don't seem wide enough so I'm trying to figure out what offset would work for a 12" wheel and I'm having trouble finding information. Is anyone familiar with 12" wheel setups and/or running 345s? More on mustang6g.com
🌐 mustang6g.com
0
November 15, 2018
345s
😮‍💨😮‍💨😮‍💨 More on reddit.com
🌐 r/hellcat
14
58
October 26, 2023
Top answer
1 of 3
2

tl;dr

Instant.parse( "2016-12-23T01:23:45Z" )
       .plusNanos( Math.round( 
           yourNumberOfMinutesAsDouble * 
           TimeUnit.MINUTES.toNanos( 1 ) ) 
        ) 

Avoid old date-time classes.

Actually, you should using neither java.util.Date nor java.util.Calendar. These old legacy classes are notoriously troublesome, confusing, and flawed. Now supplanted by the java.time classes.

For the old classes, the Answer by Jireugi is correct. For java.time classes, read on.

Avoid using a fractional number for elapsed time

Not a good idea using a double or Double to represent elapsed time. Firstly, that type uses floating-point technology which trades away accuracy for speed of execution. So you will often have extraneous extra digits to the right of your decimal fraction.

Secondly, this is an awkward way to handle time, given that we have sixty seconds to a minute, and sixty minutes to an hour, and so on.

  • In Java, use the Period or Duration classes. See Oracle Tutorial.
  • In text, use the standard ISO 8601 format PnYnMnDTnHnMnS where P marks the beginning and T separates the years-months-days from the hours-minutes-seconds. So two and a half minutes would be PT2M30S.

Nanoseconds

If we must work with the Double as a number of minutes for elapsed time, let’s convert from your fractional decimal number to a whole number (integer).

Note that the old legacy date-time classes are limited to a resolution of milliseconds while the java.time classes can go as fine as nanoseconds. So we want to convert your Double to a whole number of nanoseconds.

Rather than hard-code a magic number of the number of nanoseconds in a minute for this calculation, let's use the TimeUnit enum. That class can calculate the number of nanoseconds in a minute for us ( 60 * 1_000_000_000L ).

Finally, the Math.round function returns the closest long to the argument, with ties rounding to positive infinity.

long nanoseconds = Math.round( 
    yourNumberOfMinutesAsDouble * 
    TimeUnit.MINUTES.toNanos( 1 ) 
);

Instant

If working with date-time values in UTC, use the Instant class. Each Instant represents a moment on the timeline in UTC with a resolution of nanoseconds.

Instant Instant.parse( "2016-12-23T01:23:45Z" )
Instant future = Instant.plusNanos( nanoseconds ); 

Duration

Rather than passing around a Double as your elapsed time, I strongly suggest you pass around Duration objects.

Duration duration = Duration.ofNanos( Math.round( yourNumberOfMinutesAsDouble * TimeUnit.MINUTES.toNanos( 1 ) ) );

You can do math with a Duration such as plus and minus.

Instant instant = Instant.parse( "2016-12-23T01:23:45Z" )
Instant future = instant.plus( duration );

You can generate a String representation of the Duration in standard ISO 8601 format such as PT8H6M12.345S by merely calling toString. And Duration can parse such strings as well.

String output = duration.toString(); // PT8H6M12.345S

…or going the other direction…

Duration duration = Duration.parse( "PT8H6M12.345S" );
2 of 3
2

You could try this using Math.round:

Date clock;
SimpleDateFormat reqDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
clock = reqDF.parse(line[25]);
Double distance = distDB.find_distance(O, D, mode, facility_id);

long clockTimeMs = clock.getTime();
long distTimeInMs = Math.round(distance * 60000);
Date current_time = new Date(clockTimeMs + distTimeInMs);

Here the Date gets converted into a milliseconds timestamp. Since the distance is in minutes, you need to convert it also into milliseconds by multiplying it by 60 * 1000 (= 60000) before you can add it to the start time ("clock"). Finally a new Date gets created that represents the distance from the start time.

Please find details of the Date class here: https://docs.oracle.com/javase/6/docs/api/java/util/Date.html

🌐
What to Build
whatobuild.com › costco-iwilei › iso-8601-duration-5-minutes
iso 8601 duration 5 minutes
September 20, 2021 - ... For example, 22 minutes after 5:00 p.m. the afternoon of February 22, ... A string representation of this duration using ISO-8601 seconds based representation, such as PT8H6M12.345S.
🌐
Fitness and Exercise Equipment Repair Parts
fitnessrepairparts.com › equipment › Select › 983 › Proform › Crosswalk-345s-831.29403.0
Proform - Crosswalk 345s - 831.29403.0 | Fitness and Exercise Equipment Repair Parts
Find spare or replacement parts for your treadmill: Proform Crosswalk 345s - 831.29403.0. View parts list and exploded diagrams for Entire Unit. Treadmill
🌐
Amazon
amazon.com › OADHTIE-Battery-Replacement-340s-5-345s-4 › dp › B0DCTBN3F9
Amazon.com: OADHTIE Battery Replacement for Braun 340s-5, 345S, 345s-4, 345s-5, 350CC, 350CC 5774 Series 3, 360, 360 5779 Series 3, Part Number: 0025864, 1HR-AAAUV, 5735709, 5773701, 5774701 2000mAh/1.2V : Health & Household
Buy OADHTIE Battery Replacement for Braun 340s-5, 345S, 345s-4, 345s-5, 350CC, 350CC 5774 Series 3, 360, 360 5779 Series 3, Part Number: 0025864, 1HR-AAAUV, 5735709, 5773701, 5774701 2000mAh/1.2V: Household Batteries - Amazon.com ✓ FREE DELIVERY possible on eligible purchases
🌐
2GIG
2gig.com › home › 345s sensors
345S Sensors Archives | 2GIG
Skip to content · 345S Sensors · Showing all 14 results · 345S 4-Button Security Panel Key Ring Remote · See More · 345S Carbon Monoxide Detector · 345S Firefighter Smoke And Co Detector Listener · 345S Passive Infrared Motion Detector
Find elsewhere
🌐
Mustang6G
mustang6g.com › forums › tech › wheels & tires
My Quest for 345s | 2015+ S550 Mustang Forum (GT, EcoBoost, GT350, GT500, Bullitt, Mach 1) - Mustang6G.com
November 15, 2018 - I'm looking at getting michelin pilot sport 4S 345/30ZR20 in the rear of my 2016 GT. 11" wheels don't seem wide enough so I'm trying to figure out what offset would work for a 12" wheel and I'm having trouble finding information. Is anyone familiar with 12" wheel setups and/or running 345s?
🌐
Reddit
reddit.com › r/treadmills › its an old 345s proform.
r/treadmills on Reddit: Its an old 345s proform.
1 month ago -

I got it free. its compact and fits my needs. plugged it in and got power but then started getting smoke and the burnt wire smell from by the pulse button. gonna take apart the head unit but anyone have any ideas?

🌐
GeoArm
geoarm.com › 2gig-rptr100-345-wireless-345s-alarm-repeater.html
2GIG-RPTR100-345 - 2GIG Wireless 345S Series Alarm Repeater (for 345 MHz Frequency)
The 2GIG-RPTR100-345 wireless 345S series alarm repeater is designed to extend the communication range of 2GIG security systems, providing greater flexibility and reliability in wireless sensor placement - especially in large homes, offices, ...
🌐
Surety
suretyhome.com › surety store › store index products › security alarm › 2gig 345s 4-button key ring remote
2GIG 345S 4-Button Key Ring Remote - 2GIG 2GIG-KEY100-345 - Surety
2GIG 345S 4-Button Key Ring Remote
Features: Arm and disarm the system before entering the home. Keyfob operates in encrypted or non-encrypted mode. Designed o fit on a key chain, in a pocket, or in a purse. Supports encryption via an on-board switch Panel Compatibility Qolsys w/ 345*2GIG GC2/E2GIG Edge2GIG GC Touch * Qolsys brand panels cannot take advantage of 345S sensor encryption 1 year warranty
Price   $20.00
🌐
GoToLee
gotolee.com › buy › product › 345s › 650476
345S | Lee Supply
345S - LAMBRO 5IN ALUMINUM WALL EXHAUST HOOD VENT - SCREEN
The 5 inch aluminum exhaust wall hood vent with 3 inch connection collar is ideal for venting through the wall. This vent is used for bath fan exhaust, range hood exhaust and other general venting applications where exhaust air needs to exit to the exterior. The exhaust vent allows for maximum exhaust airflow using a spring controlled damper that prevents back drafts and critters from entering the home through the vent when not in use. Made from 22 gauge aluminum for durability and will not rust to maintain longevity. Check local building codes prior to installation.
Price   $23.92
🌐
2GIG
2gig.com › home › 345s sensors
345S Wireless Repeater | 2GIG
September 15, 2025 - The 2GIG 345MHz Repeater enhances 2GIG security systems by offering greater flexibility in wireless sensor placement. It can be strategically positioned to extend the range of 2GIG panels, making it ideal for larger project. Coming Soon
🌐
2GIG
2gig.com › home › 345s sensors
345S Wireless Panic Button Pendant Remote | 2GIG
September 15, 2025 - The 2GIG Panic Button Remote is a compact, battery-powered, wireless device that transmits an emergency signal from any location within RF range of the control panel, regardless of whether the system is armed or disarmed. Coming Soon
🌐
2GIG
2gig.com › home › 345s sensors
345S Carbon Monoxide Detector | 2GIG
September 15, 2025 - 2GIG 345S sensors are compatible with the complete 2GIG security ecosystem including the GC Touch™ and 2GIG EDGE™ security panels.
🌐
Javafixing
javafixing.com › 2022 › 06 › fixed-max-age-cookie-value-using-spring.html
[FIXED] Max-Age cookie value using Spring ResponseCookie ~ JavaFixing
June 16, 2022 - Duration toString() returns a string representation of duration using ISO-8601 seconds based representation, such as PT8H6M12.345S.