I have a very long string of characters that contain a date and time. How can I extract just the date part and the time part from it?
Here's the string: 0:2019010309130000:0.000000:126:0
I just need to extract the date and the time as in:
Date - 20190103 Time - 0913 and format it as 09:13
答案 0 :(得分:0)
This applies to Python programming language.:
If the string stays in the same format I believe you should be able to extract it using a concept known as "slicing" (you can find more about it in here).
x = "0:2019010309130000:0.000000:126:0"
y = 'Date - {} Time - {}:{}'.format(x[2:10], x[10:12], x[12:14])
print(y)