In my job i need to make a change which says,, If the Ship_date is Sunday, Change it to previous day i.e Saturday or else keepp the Ship Date for other days,
FYI the Ship date is Timestamp feild
Please if Someone can help me
If Date is Sunday,Change it to Saturday(Previous DAy)
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 58
- Joined: Mon Dec 14, 2015 3:16 pm
- Location: Arizona
Okay, which part do you need help with? Rather than spoon-feed an answer, would rather do more of a nudge in the proper direction. Or at least give that a shot.
The Parallel Transform functions are all documented and the section on 'Date and Time Functions' will be very helpful here. You can use them to determine the "Day of Week" and then if it is a Sunday, decrement the date by one day. Use them in stage variables in a transformer to make the date change that you need. Give that a shot and let us know if you have any specific questions!
The Parallel Transform functions are all documented and the section on 'Date and Time Functions' will be very helpful here. You can use them to determine the "Day of Week" and then if it is a Sunday, decrement the date by one day. Use them in stage variables in a transformer to make the date change that you need. Give that a shot and let us know if you have any specific questions!
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Look at this page:
http://www.ibm.com/support/knowledgecen ... ml?lang=en
Particularly: WeekdayFromDate()
-T.J.
http://www.ibm.com/support/knowledgecen ... ml?lang=en
Particularly: WeekdayFromDate()
-T.J.
-
- Participant
- Posts: 58
- Joined: Mon Dec 14, 2015 3:16 pm
- Location: Arizona
Please review the documentation again carefully. For WeekdayFromDate, it expects a Date field, and will return a numeric value.
A numeric value is never equal to a string called "Sunday".
There is also type conversion functions detailed here:
http://www.ibm.com/support/knowledgecen ... tions.html
That would help address your conversion issues (from timestamp to date).
I know we are not giving you the answer -- we want you to find the answer yourself using those reference materials. This way, you will become a much better developer for your customer.
-T.J.
A numeric value is never equal to a string called "Sunday".
There is also type conversion functions detailed here:
http://www.ibm.com/support/knowledgecen ... tions.html
That would help address your conversion issues (from timestamp to date).
I know we are not giving you the answer -- we want you to find the answer yourself using those reference materials. This way, you will become a much better developer for your customer.
-T.J.
Specifically when it says the "day number of the week" is returned it means a 1 for Sunday (2 for Monday, etc) because Sunday is the first day of the week by default. You can override that if desired but I generally don't see a need to.Teej wrote:For WeekdayFromDate, it expects a Date field, and will return a numeric value.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers