Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mahendragaur
Creator
Creator

Convert a date into months

Hello Users,

I'm importing one of the .csv file into QlikView. The data source contains one column in format " 3/21/2016 12:00:00 AM" but I want only month from the mentioned date. I'm using month() function to fetch only months and that I am using every time but it didn't work. Could any one please tell me what may be reason that month function is not working.

below is the script I'm using -

LOAD //WorkCenter_Operation_Desc_Op_No_Key & '-' & SHOP_ORDER & '-' & Num([End Date]) AS CompositeKey,
  //WorkCenter_Operation_Desc_Op_No_Key,
   //SHOP_ORDER,
   Month([End Date]) as Month1
[LT(hrs)]
FROM
//[$(vExcel_Folder)\ChartData.csv]

(
txt, utf8, embedded labels, delimiter is ',', msq, filters(
Remove(Row, Pos(Top, 2))
));

1 Solution

Accepted Solutions
sunny_talwar

May be try this

Month(Date#([End Date], 'M/D/YYYY h:mm:ss TT')) as Month1

Also, check these links out

Why don’t my dates work?

Get the Dates Right

QlikView Date fields

View solution in original post

12 Replies
sunny_talwar

May be try this

Month(Date#([End Date], 'M/D/YYYY h:mm:ss TT')) as Month1

Also, check these links out

Why don’t my dates work?

Get the Dates Right

QlikView Date fields

stonecold111
Creator III
Creator III

date([End Date],'MM') as month

try this. if it don't work

try this one

date(timestamp#([End Date],'DD/MM/YYYY hh:mm:ss TT'),'MM')

sunny_talwar

Don't recommend doing that, because this will only display as a date, but will have an underlying date value. So in a list box, this might show 5 31 times if there is a date for each of the days in the month of May.

stonecold111
Creator III
Creator III

Yes you are right sunny..

stonecold111
Creator III
Creator III

shall we use date# in place of timestamp#  ????

as it is in timestamp format.. just for clarification

sunny_talwar

Date#() or TimeStamp#() should both work... but TimeStamp#() will be more informative

stonecold111
Creator III
Creator III

informative means in what way??? then why we need timestamp#  when date# can do the same thing

PrashantSangle

There is no such difference in both function You can use which ever you want.

See Henric reply on below thread.

date() vs timestamp()

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 🙂
sunny_talwar

When a new developer or non-developer (with limited knowledge of QlikView) see TimeStamp vs Date... he will have an easier time understanding TimeStamp as a timestamp and date as a date... so for somebody who doesn't know, it might make sense to use TimeStamp#().

then why we need timestamp#  when date# can do the same thing

I don't know, do you want to go ahead and send an email to Qlik asking them why they made Date#() and TimeStamp#() interchangeably usable?