Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to compare datetime field in script side fro Ex:
StDtTm is 01/10/2014 07:20:33 and EndDtTm is 12/26/2013 11:10:18
In above case I want to compare if EndDtTm > StDtTm then i want to set flag as 'Y' else 'N' as flag so how to compare it in script side.
If these datetimes are timestamps, the simple comparison should work like:
Load
If( EndDtTm > StDtTm, 'Y', 'N') as Flag
If they are text, try like:
If( Timestamp#(EndDtTm, 'MM/DD/YYYY hh:mm:ss') > Timestamp#(StDtTm, 'MM/DD/YYYY hh:mm:ss'), 'Y', 'N') as Flag
If these datetimes are timestamps, the simple comparison should work like:
Load
If( EndDtTm > StDtTm, 'Y', 'N') as Flag
If they are text, try like:
If( Timestamp#(EndDtTm, 'MM/DD/YYYY hh:mm:ss') > Timestamp#(StDtTm, 'MM/DD/YYYY hh:mm:ss'), 'Y', 'N') as Flag
Hi,
write the below code in your script.
if (EndDtTm>StDtTm,'Y','N') as Flag
Regards
ASHFAQ
Hi,
Use Something Like this
if(Timestamp#(EndTime,'MM/DD/YYYY hh:mm:ss') >timestamp#(StartTime,'MM/DD/YYYY hh:mm:ss') ,'Y','N')
Regards,
Vivek
Hi,
Try like this
LOAD
*,
If(EndDtTm > StDtTm, 'Y', 'N') AS Flag
FROM DataSource;
If above not working then try like this
LOAD
*,
If(Timestamp#(EndDtTm ,'MM/DD/YYYY hh:mm:ss') >Timestamp#(StDtTm,'MM/DD/YYYY hh:mm:ss') ,'Y','N')
FROM DataSource;
Hope this helps you.
Regards,
Jagan.
Hi,
It is better if convert it number while compare
Try like,
if(Num(Timestamp(Timestamp#(EndTime,'MM/DD/YYYY hh:mm:ss'))) >Num(Timestamp(timestamp#(StartTime,'MM/DD/YYYY hh:mm:ss'))) ,'Y','N') as Flag
Regards