Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Time format

hi all,

In my application having an filed CDT with datetime format.

Now i needs to have new field only with hours and minutes.

Ex: My CDT with DateTime format will look like below

CDT

01/01/2013 00:00:15

01/01/2013 00:01:00

01/01/2013 00:50:00

01/01/2013 01:01:00

01/01/2013 13:05:00

01/01/2013 23:50:00

Now i want new field only with Hour ans Minutes as below for above example

NewCDT

0

1

101

50

1305

2350

Please can anyone let me know how to do this.

Thanks in advance.

1 Solution

Accepted Solutions
jagannalla
Partner - Specialist III
Partner - Specialist III

Try this

     Num(Num#(Text(Timestamp(CDT,'hmm'))))

Hope it helps you..

View solution in original post

4 Replies
sreenivas
Creator III
Creator III

PFA

jagannalla
Partner - Specialist III
Partner - Specialist III

Try this

     Num(Num#(Text(Timestamp(CDT,'hmm'))))

Hope it helps you..

Not applicable
Author

hi

try this

A:

LOAD *

INLINE [

    CDT

    01/01/2013 00:00:15

    01/01/2013 00:01:00

    01/01/2013 00:50:00

    01/01/2013 01:01:00

    01/01/2013 13:05:00

    01/01/2013 23:50:00

];

LOAD *, Date(Date#(CDT,'MM/DD/YYYY hh:mm:ss'),'hhmm') as newCDT

Resident A;

then output like this

newCDT
0
1
50
101
1305
2350
Not applicable
Author

Hi. You can also use

Hour(Date#(CDT,'DD/MM/YYYY hh:mm:ss')) as Hours,

Minute(Date#(CDT,'DD/MM/YYYY hh:mm:ss')) as Minute,

Hour(Date#(CDT,'DD/MM/YYYY hh:mm:ss')) & ':' & minute(Date#(CDT,'DD/MM/YYYY hh:mm:ss')) as HM

Alessandro Furtado