Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to generate begin and end dates in UTC?

anil_m
8 - Asteroid

Hi,

 

I am planning to call a survey monkey restful API to collect the data, But the API  accepts the date arguments in the following UTC format.

 

 YYYY-MM-DDTHH:MM:SS+HH:MM

 

As I want to schedule this API every day, I wan to generate current day begin and end dates in the above format.

 

I have created 2018-08-29 00:00:00  and 2018-08-29 23:59:59 dates and called DateTimeToUTC(dt) on these begin and end dates. But the result format is not as above.

Any ideas on how to generate dates in the above format?

4 REPLIES 4
CharlieS
17 - Castor
17 - Castor

Maybe this is a crude solution, but could you just build the "YYYY-MM-DD HH:MM:SS" string with the DateTime functions, then convert to a string and replace the space with a "T"? 

 

Alteryx Formula:

replace(tostring(DateTimeFormat(DateTimeToday(),"%Y-%m-%d %T")),' ','T')

 

Result:

2018-08-29T00:00:00

ivoller
12 - Quasar

I think @CharlieS is probably on to something.

 

I assumed that you wanted to calculate the TZD and use that in the final output. That involves calculating the difference in the UTC and the original date and then doing some formatting to get the HH:MM part correct. See below for (probably over complex) approach

2018-08-29_17-17-13.png

 

anil_m
8 - Asteroid

Thanks for the replies. But the in the above output both the dates are showing as 2018-08-29T04:00, how about begin and end times

ivoller
12 - Quasar

Is this correct? I think I misunderstood the format required.

 

2018-08-30_11-20-37.png

Labels
Top Solution Authors