cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-670450%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%EC%88%AB%EC%9E%90%EB%A5%BC%20%EB%B0%80%EB%A6%AC%EC%B4%88%20%EB%8B%A8%EC%9C%84%EB%A1%9C%20%EB%82%A0%EC%A7%9C%2F%EC%8B%9C%EA%B0%84%EC%9C%BC%EB%A1%9C%20%EB%B3%80%ED%99%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-670450%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%EC%95%88%EB%85%95%ED%95%98%EC%84%B8%EC%9A%94%2C%20%EA%B0%92%EC%9D%B4%20'20230818103947300000'%20%ED%98%95%EC%8B%9D%EC%9D%B8%20%EC%97%B4%EC%9D%B4%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CP%3E%EC%82%AC%EC%9A%A9%EC%9E%90%20%EC%A7%80%EC%A0%95%20%ED%98%95%EC%8B%9D(%EC%98%88%3A%20%3CYYYY%3E%3CMM%3E%3CDL%3E%3CDD%3E%20%EB%93%B1)%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%EB%B3%80%ED%99%98%ED%95%A0%20%EC%88%98%20%EC%9E%88%EA%B8%B0%EB%A5%BC%20%EB%B0%94%EB%9E%90%EC%A7%80%EB%A7%8C%20%EB%B0%80%EB%A6%AC%EC%B4%88%20%EC%98%B5%EC%85%98%EC%9D%B4%20%ED%91%9C%EC%8B%9C%EB%90%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EB%AC%BC%EB%A1%A0%20%EA%B0%81%20%EA%B0%9C%EB%B3%84%20%EC%9A%94%EC%86%8C%EB%A5%BC%20%EC%B6%94%EC%B6%9C%ED%95%9C%20%EB%8B%A4%EC%9D%8C%20%ED%95%A8%EA%BB%98%20%EC%B6%94%EA%B0%80%ED%95%98%EB%8A%94%20%EA%B8%B4%20%EA%B3%B5%EC%8B%9D%EC%9D%84%20%EB%A7%8C%EB%93%A4%20%EC%88%98%20%EC%9E%88%EC%A7%80%EB%A7%8C%20%EC%A0%95%EB%A7%90%20%ED%94%BC%ED%95%98%EA%B3%A0%20%EC%8B%B6%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FDD%3E%3C%2FDL%3E%3C%2FMM%3E%3C%2FYYYY%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%EC%B0%B8%EA%B3%A0%EB%A1%9C%20%ED%8C%8C%EC%9D%B4%EC%8D%AC%EC%97%90%EC%84%9C%EB%8A%94%20datetime%20%EA%B0%9C%EC%B2%B4%20dt%EB%A5%BC%20%EC%96%BB%EA%B8%B0%20%EC%9C%84%ED%95%B4%20%ED%95%9C%20%EC%A4%84%EB%A1%9C%20%EC%9D%B4%20%EC%9E%91%EC%97%85%EC%9D%84%20%EC%88%98%ED%96%89%ED%95%A0%20%EC%88%98%20%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4.%3C%2FP%3E%3CP%3Edatetime%20import%20datetime%EC%97%90%EC%84%9C%3CBR%20%2F%3E%20d%3D'20230818103947300000'%3CBR%20%2F%3E%20dt%3Ddatetime.strptime(d%2C'%25Y%25m%25d%25H%25M%25S%25f')%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-670450%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%EA%B8%B0%EB%B3%B8%20%EB%8D%B0%EC%9D%B4%ED%84%B0%20%EB%B6%84%EC%84%9D%20%EB%B0%8F%20%EB%AA%A8%EB%8D%B8%EB%A7%81%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Choose Language Hide Translation Bar
mvanderaa1
Level IV

convert number to datetime with milliseconds

Hi, I have a column with values of the following format: '20230818103947300000'

I was hoping to be able to convert it using the custom format (i.e. <YYYY><MM><dd> etc), but I do not see the option for milliseconds. Of course I can make a long formula to extract each individual element and then adding them together, but I really want to avoid that.

 

For reference, in python I am able to do this in one line to get my datetime object dt:

from datetime import datetime
d='20230818103947300000'
dt=datetime.strptime(d,'%Y%m%d%H%M%S%f')

1 REPLY 1
jthi
Super User

Re: convert number to datetime with milliseconds

Seems like you have to have "." as separator within seconds

Names Default To Here(1);

str = "20230818103947300000";
Insert Into(str, ".", Length("YYYYMMDDHHMMSS") +1);
date_formatted = Informat(str, "Format Pattern", "<YYYY><MM><DD><hh24><mm><ss>");
date_with_ms = Format(date_formatted, "yyyy-mm-ddThh:mm:ss", 25,3); // "2023-08-18T10:39:47.300"
-Jarmo

Recommended Articles