Skip to main content
Announcements
Do More with Qlik - Qlik Cloud Analytics Recap and Getting Started, June 19: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Saparate date and time from field

Hi all..........

My startdatetime is 8/1/2013  0:02  so for that how can i saparate date and time .Please help me.

1 Solution

Accepted Solutions
Not applicable
Author

Hi Chandani,

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;

View solution in original post

9 Replies
PrashantSangle

Hi,

You can use

Date() to get date only

Time() to get time only

Also you can use subfield()

Like Subfield(dateFieldName,' ',1) as Date,

Subfield(dateFieldName,' ',2) as Time,

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anonymous
Not applicable
Author

Hi Max..........

Thanx for your answer................Its helpfull for me...........

sujeetsingh
Master III
Master III

Date(Startdate,'dd/mm/yyyy') for date and

Time stamp(Startdate,'h:mm:ss[.fff] TT') time

PrashantSangle

Hi,

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

Like

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

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
CELAMBARASAN
Partner - Champion
Partner - Champion

Try this

Simply using Date and Time functions doesn't really split the date and time from a field. It just the changes display value

Date(Floor(startdatetime )) AS StartDate,

Time(Frac(startdatetime )) AS StartTime

Thanks

Anonymous
Not applicable
Author

Hi..........

Now i got my date as 7/31/2013.When i tried to get the month from my date by following script it gives some error..........

Subfield(STARTDATETIME,' ',1) as myDate,

//Date(STARTDATETIME,'dd/mm/yyyy')as mydate,

month(mydate) as mymonth,

Subfield(STARTDATETIME,' ',2) as mytme,

so for that how can i get month from mydate...................

Not applicable
Author

Hi Chandani,

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;

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Try with below


LOAD

     *,

     Date(Floor(startdatetime )) AS StartDate,

     Time(Frac(startdatetime )) AS StartTime

     Month(startdatetime) AS StartDateMonth; //Preceding Load statement

LOAD

Date(Date#(startdatetime, 'M/D/YYYY H:m')) AS startdatetime

From ...;


Anonymous
Not applicable
Author

Hi.............

Now i got my exact solution..............