cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

DateTime format issue

LiPav
Level II

Hi,

 

I have datetime data always saved in format "day/month/year hour.minute" in a column in csv file.

 

I want to calculate time interval, but JMP flips month and day, when reading the csv file and gives me 734,23 hours instead of less than 24 hours for attached data set.

 

I have tried to set Input Format and Output Format, but it didn't help. Any ideas ? 

dtTime = Open( "DateTime.jmp" );

dtTime:DateTime << Input Format( "d/m/y h:m" );
 
Round( (Col Max( dtAFMtime_xlxs:DateTime ) - Col Min( dtAFMtime_xlxs:DateTime )) / 60 / 60, 2 );

/*Open(
	"DateTime.jmp",
	columns( New Column( "DateTime", Numeric, "Continuous", Format( "d/m/y h.m", 19 ), Input Format( "d/m/y h.m" ) ) ) 
);*/

 

Regards,

Li

 

Li Pavlov
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User


Re: DateTime format issue

try this

Names Default To Here( 1 );
//dtTime = Open( "DateTime.jmp" );
dttime = Current Data Table();
dtTime << New Column( "new DateTime",
	set each value(
		Date MDY( Day( dtTime:DateTime ), Month( dtTime:DateTime ), Year( dtTime:DateTime ) )
		+3600 * hour( dtTime:DateTime ) + 60 * Minute( dtTime:DateTime )
		+ Second( dtTime:DateTime )
	),
	Format( "m/d/y h:m" )
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User


Re: DateTime format issue

try this

Names Default To Here( 1 );
//dtTime = Open( "DateTime.jmp" );
dttime = Current Data Table();
dtTime << New Column( "new DateTime",
	set each value(
		Date MDY( Day( dtTime:DateTime ), Month( dtTime:DateTime ), Year( dtTime:DateTime ) )
		+3600 * hour( dtTime:DateTime ) + 60 * Minute( dtTime:DateTime )
		+ Second( dtTime:DateTime )
	),
	Format( "m/d/y h:m" )
);
Jim
LiPav
Level II


Re: DateTime format issue

Thank you! It makes the trick  

Li Pavlov