Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
trishita
Creator III
Creator III

Timestamp extraction

 

How to extract timestamp from a date field of format yy-mm-dd hh:mm to have a result only yy-mm-dd

 

9 Replies
YoussefBelloum
Champion
Champion

Hi

so here you want to extract a date from a timestamp ?

try this:

=Date(Floor(your_field))

bhaskar_sm
Partner - Creator III
Partner - Creator III

Hi,

You can use Date function with floor and Num function.

Date(floor(num(TimeStampField)),'YY-MM-DD') as Date

Regards,

Bhasker Kumar

jonathandienst
Partner - Champion III
Partner - Champion III

If the field is text, then this will interpret and convert

Date(Floor(Timestamp#(DateField, 'yy-MM-dd hh:mm'), 'yy-MM-dd')

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sasiparupudi1
Master III
Master III

Date(Floor(Timestamp#(YourDate,'YY-MM-DD hh:mm')),'YY-MM-DD')

trishita
Creator III
Creator III
Author

 

LOAD

BUNKER_DELIVERY_NOTE_NUMBER,
DENSITY,
DIFFERENTIAL_REASON,
FUEL_MASS_AFTER_SOUNDING,
FUEL_MASS_BEFORE_SOUNDING,
FUEL_TYPE,
IMO_NUMBER,
LOWER_HEATING_VALUE,
SOUNDING_TIME_TIMEZONE,
SOUNDING_TIME_UTC,
SULPHUR_CONTENT,
TEMPERATURE,
VISCOSITY,
WATER_CONTENT
FROM
mo_purch_sounding_correction_view.qvd

(
qvd);

 

SOUNDING_TIME_UTC in a view is of format yy-mm-dd hh:mm .I want to extract out the hh:mm and have result in form of only YY-MM-DD:

The  field SOUNDING_TIME_UTC is in the form of vsql_varchar

trishita
Creator III
Creator III
Author

SOUNDING_TIME_UTC in a view is of format yy-mm-dd hh:mm .I want to extract out the hh:mm and have result in form of only YY-MM-DD:

The  field SOUNDING_TIME_UTC is in the form of vsql_varchar

sasiparupudi1
Master III
Master III

LOAD

BUNKER_DELIVERY_NOTE_NUMBER,
DENSITY,
DIFFERENTIAL_REASON,
FUEL_MASS_AFTER_SOUNDING,
FUEL_MASS_BEFORE_SOUNDING,
FUEL_TYPE,
IMO_NUMBER,
LOWER_HEATING_VALUE,
SOUNDING_TIME_TIMEZONE,
Date(Floor(Timestamp#(SOUNDING_TIME_UTC,'YY-MM-DD hh:mm')),'YY-MM-DD') AS SOUNDING_DATE,
SULPHUR_CONTENT,
TEMPERATURE,
VISCOSITY,
WATER_CONTENT
FROM
mo_purch_sounding_correction_view.qvd

(
qvd);

bhaskar_sm
Partner - Creator III
Partner - Creator III

SubField(SOUNDING_TIME_UTC ,'  ',1)  as Date

vishalarote
Partner - Creator II
Partner - Creator II

Try this

😧

LOAD * INLINE [

Date

10-01-15 10:45

];

load

Date(Date#(date(floor(Timestamp#(Date,'yy-mm-dd hh:mm'))),'dd-mm-yyyy'),'yy-mm-dd') as NDate

Resident D;

Capture20.PNG