Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date stamp

Hello,

In the source data is a date stamp given like: 3/8/2016 8:00:00 AM

This has to be transform to only the date 08-03-2016 so I can use it in a chart.

Caution by a date 3/16/2016 is an extra character.

The transformation has to be done in the script.

Can you help me with the script?

Thanks in advance.

Ralph

1 Solution

Accepted Solutions
sunny_talwar

I don't know what the difference is between the dates, they all look the same. See the attached

Script:

Data:

LOAD [Technical Designation],

  [User Designation],

  [System Description],

  Parameter,

  Value,

  Unit,

  Status,

  [Value Timestamp],

  Date(Floor(TimeStamp#([Value Timestamp], 'M/D/YYYY h:mm TT')), 'DD-MM-YYYY') as [Value Date]

FROM

Database*.xls

(biff, embedded labels, header is 19 lines, table is [Installatie Status PX Tapwater$]);


Capture.PNG

View solution in original post

13 Replies
sunny_talwar

May be this:

Date(Floor(TimeStamp#(DateField, 'M/D/YYYY h:mm:ss TT')), 'DD-MM-YYYY') as DateField

maxgro
MVP
MVP

load

  datefield,

  Date(Floor(Date#(datefield, 'M/D/YYYY h:mm:ss tt')), 'MM-DD-YYYY') as datefieldnew  

inline [

datefield

3/8/2016 8:00:00 AM

];

Not applicable
Author

Hello Sunny T,

Thank you for you're reaction.

Sorry but it doesn't work.

sunny_talwar

Seems to be working here:

Capture.PNG

Script:

Table:

LOAD *,

  Date(Floor(TimeStamp#(DateField, 'M/D/YYYY h:mm:ss TT')), 'DD-MM-YYYY') as NewDateField;

LOAD * Inline [

DateField

3/8/2016 8:00:00 AM

];

Can you have more than one space between the date and time? You will have to adjust the highlighted part of the expression to match your current timestamp format

Not applicable
Author

Hello maxgro,

Thanks, but it won't work. Can you help me further, below the script.

Value Timestamp is the date i.e. [3/25/2016 8:10:25 AM ]

Data:
LOAD [Technical Designation],
[User Designation],
[System Description],
Parameter,
Value,
Unit,
Status,
[Value Timestamp]
FROM
[Data\Legionella\Installatie Status PX *.xls]
(
biff, embedded labels, header is 19 lines, table is [Installatie Status PX Tapwater$]);

load
[Value Timestamp],
Date(Floor(Date#([Value Timestamp], 'M/D/YYYY hh:mm:ss tt')), 'MM-DD-YYYY') as Date2  
inline [Value Timestamp];

sunny_talwar

Try it like this:

Data:

LOAD *,

          Date(Floor(TimeStamp#([Value Timestamp], 'M/D/YYYY h:mm:ss TT')), 'DD-MM-YYYY') as [Value Date];
LOAD [Technical Designation],
[User Designation],
[System Description],
Parameter,
Value,
Unit,
Status,
[Value Timestamp]
FROM
[Data\Legionella\Installatie Status PX *.xls]
(biff, embedded labels, header is 19 lines, table is
[Installatie Status PX Tapwater$]);

pooja_sn
Creator
Creator

=Date(Floor(TimeStamp#('3/8/2016 8:00:00 AM', 'M/D/YYYY h:mm:ss TT')), 'DD-MM-YYYY')

Not applicable
Author

You're attachment works also by me but in the file it doesn't. 

I will attach the qwv file and database

sunny_talwar

Your timestamp did not have seconds:

LOAD *,

Date(Floor(TimeStamp#([Value Timestamp], 'M/D/YYYY h:mm TT')), 'DD-MM-YYYY') as [Value Date];

LOAD [Technical Designation],

[User Designation],

[System Description],

Parameter,

Value,

Unit,

Status,

[Value Timestamp]

FROM

Database.xlsx

(ooxml, embedded labels, header is 19 lines, table is [Installatie Status PX Tapwater]);