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

how to convert linux date to only minutes

hello

how to convert linux date to only minutes DD/MM/YYYY hh:mm

i didn't get it it work with second but in minutes this did't work

thanks for your helps

1 Solution

Accepted Solutions
bbmmouha
Creator
Creator
Author

the trick is that when i use TimeStamp(Makedate(1970,1,1)+ date_order /24/60/60 ,'DD/MM/YYYY hh:mm' ) it display in minutes but still join in second

i modified it to  Timestamp#(TimeStamp(Makedate(1970,1,1)+ date_order /24/60/60 ,'DD/MM/YYYY hh:mm' ),'DD/MM/YYYY hh:mm')

and it ok

thank you Anil

View solution in original post

12 Replies
kfoudhaily
Partner - Creator III
Partner - Creator III

linux date is stored as number of seconds since  january 1st 1970 00:00:00 UTC

so to get minutes you need to devide by 60

1530519179            "in seconds"     = (ISO 8601: 2018-07-02T08:12:59Z)

1530519179 /60     "in minutes"      = (ISO 8601: 2018-07-02T08:12:59Z)

QlikView Qlik Sense consultant
bbmmouha
Creator
Creator
Author

thanks but what i want is to convert that to date like DD/MM/YYYY hh:mm

kfoudhaily
Partner - Creator III
Partner - Creator III

Capture.PNG

QlikView Qlik Sense consultant
Chanty4u
MVP
MVP

may be try this

subfield(DateField,' ',2) as Min

Anil_Babu_Samineni

How is your format in UNIX looks like?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
bbmmouha
Creator
Creator
Author

table_test:

LOAD

       timestamp((date_order/(24*60*60)) + (2 + date#('1/1/1970') - date#('1/1/1900')),'DD/MM/YYYY hh:mm') as TimesTampLinuxM,

    quantite,

    prix,

    State

FROM [lib://bd.test/Classeur1.xlsx]

(ooxml, embedded labels, table is Feuil1);

QuartersMap: 

MAPPING LOAD  

rowno() as Month,

'Q' & Ceil (rowno()/3) as Quarter 

AUTOGENERATE (12); 

 

MinMaxDates: 

LOAD Floor(Min(TimeStamp#([$(vFieldDateTimeM)], 'DD/MM/YYYY hh:mm'))) AS MinDate,  

     Floor(Max(TimeStamp#([$(vFieldDateTimeM)], 'DD/MM/YYYY hh:mm'))) AS MaxDate 

RESIDENT $(vTableDate); 

 

LET vMinDate = FieldValue('MinDate', 1); 

LET vMaxDate = FieldValue('MaxDate', 1);  

 

DROP TABLE MinMaxDates;  

 

TempCalendar: 

LOAD DayStart(TimeStamp(TimeStamp#($(vMinDate),'DD/MM/YYYY hh:mm') + (RecNo()/60/24) + (IterNo() -1))) AS AddedDate,  

     TimeStamp(TimeStamp#($(vMinDate), 'DD/MM/YYYY hh:mm') + (RecNo()/60/24) + (IterNo() -1)) AS AddedTimeStamp 

AUTOGENERATE 1439 WHILE $(vMinDate) + IterNo() -1 <= $(vMaxDate);   

 

MasterCalendar:

LOAD   

  AddedTimeStamp  AS $(vFieldDateTimeM),

    Date(Floor(AddedTimeStamp), 'DD/MM/YYYY') as Date_test,

    AddedDate as date_test2,

  Hour(AddedTimeStamp)  AS MyHour,

Minute(AddedTimeStamp)  AS MyMinute,

Second(AddedTimeStamp)  AS MySecond,

Year(Date(Floor(AddedTimeStamp), 'DD/MM/YYYY')) As Année, 

Month(Date(Floor(AddedTimeStamp), 'DD/MM/YYYY')) As Mois,

week(AddedTimeStamp) As Semaine, 

    Day(AddedTimeStamp) As Jour, 

YeartoDate(AddedTimeStamp)*-1 as CurYTDFlag, 

YeartoDate(AddedTimeStamp,-1)*-1 as LastYTDFlag, 

InYear(AddedTimeStamp, Monthstart($(vMaxDate)),-1) as RC12, 

Date(monthstart(AddedTimeStamp), 'MMM-YYYY') as MonthYear,

ApplyMap('QuartersMap', month(AddedTimeStamp), Null()) as Trimestre, 

Week(weekstart(AddedTimeStamp)) & '-' & WeekYear(AddedTimeStamp) as WeekYear, 

WeekDay(AddedTimeStamp) as JourSem ,

    Date(Floor(AddedTimeStamp) -7, 'DD/MM/YYYY') as [j-7] ,

    Date(Floor(AddedTimeStamp) -14, 'DD/MM/YYYY') as [J-14]

RESIDENT TempCalendar

ORDER BY AddedTimeStamp  ASC;

DROP TABLE TempCalendar;

but this didn't work

when it is in seconds it work

bbmmouha
Creator
Creator
Author

this just for display i know it

Anil_Babu_Samineni

Can you check this? Then, We will write Master calendar

table_test:

LOAD

       TimeStamp(Makedate(1970,1,1)+ date_order /24/60/60) as TimesTampLinuxM,

    quantite,

    prix,

    State

FROM [lib://bd.test/Classeur1.xlsx]

(ooxml, embedded labels, table is Feuil1);

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
bbmmouha
Creator
Creator
Author

for this it work

the problem is that when i work whith the master calendar it didn't work like it didn't get the same date

it didn't establish links