Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Re: Date stamp

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

13 Replies

Re: Date stamp

May be this:

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

MVP
MVP

Re: Date stamp

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

Re: Date stamp

Hello Sunny T,

Thank you for you're reaction.

Sorry but it doesn't work.

Re: Date stamp

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

Re: Date stamp

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];

Re: Date stamp

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
Contributor

Re: Date stamp

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

Not applicable

Re: Date stamp

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

I will attach the qwv file and database

Re: Date stamp

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]);

Community Browser