Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tomcatxx
Creator
Creator

1 field in 2 columns Load?

Hello there,

I have a column of Table like this.

Time
3/12/2015 00:21
12/11/2014 01:12
1/5/2014 00:32
...

I want to load that in 2 columns like this. The loaded Date has a same length.

DateTime
03/12/201500:21
12/11/201401:12
01/05/201400:32
......

Have u a ideal? Thanks.

1 Solution

Accepted Solutions
shiveshsingh
Master
Master

Please try this

T:LOAD * INLINE [ 

    Time

    3/12/2015 00:21

    12/11/2014 01:12

    1/5/2014 00:32

];

F:

load SubField(Time,' ',1) as Date,

Right(Time,4) as Time

Resident T;

View solution in original post

14 Replies
shiveshsingh
Master
Master

Please try this

T:LOAD * INLINE [ 

    Time

    3/12/2015 00:21

    12/11/2014 01:12

    1/5/2014 00:32

];

F:

load SubField(Time,' ',1) as Date,

Right(Time,4) as Time

Resident T;

shiveshsingh
Master
Master

OR THIS

T:LOAD * INLINE [

 

    Time

    3/12/2015 00:21

    12/11/2014 01:12

    1/5/2014 00:32

];

F:

load DATE(date#(SubField(Time,' ',1),'DD/MM/YYYY'),'DD/MM/YYYY') as Date,

Right(Time,4) as Time

Resident T;

sasiparupudi1
Master III
Master III

Date (Floor (Timestamp#(yourDateTime,'DD/MM/YYYY hh:mm'))) As Date,

Time(Frac(Timestamp#(yourDateTime,'DD/MM/YYYY hh:mm'))) As Time

vishsaggi
Champion III
Champion III

Try this?

DateField:
LOAD *, Timestamp(Timestamp#(DateTimeField, 'MM/DD/YYYY hh:mm'), 'hh:mm') AS TimeStamp,
Date(Date#(DateTimeField, 'MM/DD/YYYY hh:mm'), 'MM/DD/YYYY') AS DateStamp INLINE [
DateTimeField
12/3/2015 01:21
2/6/2014 00:23
3/11/2015 00:18
]
;

sunny_talwar

Always a good idea to add Floor and Frac (like sasiparupudi1‌ added) because if you don't you will see repeating values in a list box for DateStamp and TimeStamp and you will wonder what is wrong. The problem is that Date() and TimeStamp() function are just formatting functions, they will make your field look like date and time, but if the underlying value is a date and time field.. you will see multiple dates repeating because they have different time values... similarly the same will be the case for Time...

vishsaggi
Champion III
Champion III

Fair points. Got it Sunny. Thanks for mentioning that. I thought Timestamp# and Date# would take care of that. Will they not?

sunny_talwar

Nope they won't in this case... the expression will have to be how shiveshsingh‌ did in that case

vishsaggi
Champion III
Champion III

Got it.

tomcatxx
Creator
Creator
Author

Thank you ver much.