It’s World Statistics Day! To honor the theme of the day, the JMP User Community is having conversations about the importance of trust in statistics and data. And we want to hear from you! Tell us the steps you take to ensure that your data is trustworthy.
Choose Language Hide Translation Bar
Highlighted
WHG
WHG
Level I

How do I convert a timestamp to a duration format?

I would like to convert a column containing timestamp data in the numeric "ddMonyyyy h:m:s" time format to a numeric time duration format in seconds, starting the duration in the first row of my datatable.

1 REPLY 1
Highlighted
ron_horne
Super User

Re: How do I convert a timestamp to a duration format?

Hi @WHG 

try the following script

otherwise you can do it manually using the same functions

names default to here (1);
dt = current data table ();
dt << New Column( "Duration",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula(
			Date Difference(
				:Date of Observation[1],
				:Date of Observation,
				"second"
			)
		)
	);

let us know if it works

Article Labels

    There are no labels assigned to this post.