retrieving the day of week number

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
7 posts Page 1 of 1

monahanks

Posts: 41
Joined: Wed Mar 30, 2011 10:19 am

Post by monahanks » Wed Mar 08, 2017 2:53 pm
Good afternoon,
I need to retrieve the day of the week (1 through 7) from the current date to use as a file extension. Using the date format of 'F' in a timestamp expression today (Wednesday) is always returning a value of '2' instead of '4'. What am I missing in this? My code is:
<timestamp version="1.0" disabled="false">
<format outputVariable="DW_DAY" pattern="F" />
</timestamp>

TIA,
Kevin

monahanks

Posts: 41
Joined: Wed Mar 30, 2011 10:19 am

Post by monahanks » Thu Mar 09, 2017 9:32 am
Maybe I'm misunderstanding the purpose of this value - I think it is telling me the number of occurrences of the day of the week within that month? So it is telling me that it is the second Wednesday of the month?
If so, is there a function that will tell me what day of the week it is, like '1' is Sunday, '2' is Monday, '5' is Thursday, etc? Or do I need a table that produces that?

Thanks,
Kevin

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Thu Mar 09, 2017 9:50 am
Kevin,

The option "E" allows you to get the "Day of the Week" (Sun, Mon, Tue, Wed, etc) which could give you the xref into 1,2,3,4.

Will that work?
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

monahanks

Posts: 41
Joined: Wed Mar 30, 2011 10:19 am

Post by monahanks » Thu Mar 09, 2017 12:12 pm
Thanks Rick, I guess it will have to work. I can make an xref table based on the day name to get the number. The user may want to have Monday = Day 1, so an xref would work better anyway in that situation.

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Thu Mar 09, 2017 1:02 pm
Try using a "u" instead... looks like there might be a Java Bug.

${CurrentDate('u')}

That should give you what you're looking for
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

monahanks

Posts: 41
Joined: Wed Mar 30, 2011 10:19 am

Post by monahanks » Thu Mar 09, 2017 2:47 pm
Hi Rick,
this subtracted a day from the current date? maybe I'm not using it right... I think the xref will give me what I (and the user) need.

xml code =
<timestamp version="1.0">
<format outputVariable="DU_DAY" dayOfWeek="${CurrentDate(&apos;u&apos;)}" />
</timestamp>


Result = Timestamp variable 'DU_DAY' was created and set to '2017-03-08 14:44:29.743'

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Thu Mar 09, 2017 11:51 pm
No, you don't need the "TimeStamp" task with that. Just use the function where you need it...

Like:

SetVariable DU_Day : Value="${CurrentDate(&apos;u&apos;)}"
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
7 posts Page 1 of 1