Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
Not applicable

Date & Time Field

How to split my Date into two fields Date and Time field?

4-2-2015 3-35-44 PM.jpg

1 Solution

Accepted Solutions
Highlighted
Not applicable

Re: Date & Time Field

Hey Murali,

You can try like this

Table:
Load *,
 
Date(Floor(Subfield(date, ' ',1)), 'MM/DD/YYYY') as NewDate,
 
Timestamp(Subfield(date,' ',2),'hh:mm') as Time;
  
Load Inline [
date
03/24/2014 12:15
04/22/2014 09:10
]
;
output:

   

NewDateTime
03/24/201412:15
04/22/201409:10

View solution in original post

9 Replies
Highlighted
kiranmanoharrode
Contributor III

Re: Date & Time Field


Hi Murali,

Use TimeStamp#() function for extracting Date from respective field;

for extracting date:

=Date(TimeStamp#(date,'MM/DD/YYYY HH:MM))

it will extract Date in format defined in 1st main tab of scripting (Default date format for Document)

Further extraction of time use Hour() and Minutes() functions

Regards,

Kiran

Highlighted
pokassov
Valued Contributor

Re: Date & Time Field

Hi!

date(floor(date))

and

time(frac(date))

Sergey

Highlighted
arulsettu
Honored Contributor III

Re: Date & Time Field

hi

use this to get date

date(date#('03/23/2015 12:03','MM/DD/YYYY HH:MM'))

Highlighted
Not applicable

Re: Date & Time Field

Hi @Murali srithar

Try this code

Load *,

Date#(SubField(STARTDATETIME,' ',1),'DD/MM/YYYY') as Date,

Month(Date#(SubField(STARTDATETIME,' ',1),'DD/MM/YYYY')) as Month,

Time(SubField(STARTDATETIME,' ',2) )as Time;

or

You can also use combination of timestamp() and date()

Like

date(timestamp(timestamp#(dateFieldName,''M/D/YYYY h:mm))) as NewDate

Highlighted
arulsettu
Honored Contributor III

Re: Date & Time Field

try this for time

=Date(Time#('03/23/2015 12:03','MM/DD/YYYY HH:MM'),'HH:MM')

Highlighted
bhagirath
Contributor III

Re: Date & Time Field

Date Part : DayName(date)

Time Part : date(date,'HH:MM:SS')

if this doesnt work then try this

Date Part : DayName(date#(date,'MM/DD/YYYY HH:MM'))

Time Part : date(date#(date,'MM/DD/YYYY HH:MM'),'HH:MM:SS')

Highlighted
Not applicable

Re: Date & Time Field

Hey Murali,

You can try like this

Table:
Load *,
 
Date(Floor(Subfield(date, ' ',1)), 'MM/DD/YYYY') as NewDate,
 
Timestamp(Subfield(date,' ',2),'hh:mm') as Time;
  
Load Inline [
date
03/24/2014 12:15
04/22/2014 09:10
]
;
output:

   

NewDateTime
03/24/201412:15
04/22/201409:10

View solution in original post

Highlighted
Not applicable

Re: Date & Time Field

Thanks Uday !!

Highlighted
Not applicable

Re: Date & Time Field

You are welcome Murali