cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
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
ron_horne
Super User (Alumni)

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