Convert to day of week using date field, like MOn, Tue , Wed

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
srao
Premium Member
Premium Member
Posts: 41
Joined: Mon Mar 19, 2007 12:42 pm

Convert to day of week using date field, like MOn, Tue , Wed

Post by srao »

Convert to day of week using date field, like MOn, Tue , Wed

converting date formate -2007-01-01 00:00:00.000 to--- day of week

how to solve this problem in Parallal jobs.

Thank yo
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Set the default for timestamps as %yyyy-%mmm-%dd %hh:%nn:%ss.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You're not answering the question asked. I can't or I would.

From that timestamp format, how does one get the 'Day of the Week' (Mon,Tue,Wed,etc) for that particular date?
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

:oops: I jumped ahead of myself.
Change the default timestamp as I advised. Use the TimestampToString() function to change to string and then do

Code: Select all

FIELD(date, "-", 2, 1)
This will give you the day :)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

WeekdayFromDate() will return the weekday number (based on your business rules for the start of the week). You first need to extract the date portion from the timestamp. Once you have the weekday number you can use Field() to perform a lookup from a string constant containing a delimited string of the weekday names.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply