Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
When loading the script I would like to to determine if a date and time field is a weekend or not i.e After Friday 20:00 and before Monday 8:00.
The date and time format that comes in from the database is: dd/mm/yyyy hh:mm:ss.
Thank you in advance.
Simon
Hi,
Thank you for quick reply, but in my example I want Friday Evening to be classed as the weekend. The example above would only tell me if it was a Saturday or Sunday, correct?
I would like to put this in script for loading. I have come up with a solution but its a very long if statement. If someone can come up with an easier way, I would be very grateful:
IF((WeekDay(DTATime)='Fri') AND If((Time(Frac(DTATime))>=Time('20:00:00') AND Time(Frac(DTATime))<=Time('23:59:59')), 'Night', 'Day')='Night','Weekend', IF((WeekDay(DTATime)='Sat') OR (WeekDay(DTATime)='Sun'),'Weekend', IF((WeekDay(DTATime)='Mon') AND If((Time(Frac(DTATime))>=Time('00:00:00') AND Time(Frac(DTATime))<=Time('08:00:00')), 'Night', 'Day')='Night','Weekend','Weekday'))) as DTADayType
Thank you in advance,
Simon
Hi,
Thank you for quick reply, but in my example I want Friday Evening to be classed as the weekend. The example above would only tell me if it was a Saturday or Sunday, correct?
I would like to put this in script for loading. I have come up with a solution but its a very long if statement. If someone can come up with an easier way, I would be very grateful:
IF((WeekDay(DTATime)='Fri') AND If((Time(Frac(DTATime))>=Time('20:00:00') AND Time(Frac(DTATime))<=Time('23:59:59')), 'Night', 'Day')='Night','Weekend', IF((WeekDay(DTATime)='Sat') OR (WeekDay(DTATime)='Sun'),'Weekend', IF((WeekDay(DTATime)='Mon') AND If((Time(Frac(DTATime))>=Time('00:00:00') AND Time(Frac(DTATime))<=Time('08:00:00')), 'Night', 'Day')='Night','Weekend','Weekday'))) as DTADayType
Thank you in advance,
Simon