cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yoshihirok
Memorable Member
Memorable Member

Tips: convert from Twitter's "Created At" string format to SQL Server DateTime compatible format.

I want to share my tips about Twitter's "Created At".

For inserting "Created At" to SQL Server DateTime type column. 

 

Tips:

  Convert from Twitter's "Created At" String format to SQL Server datetime compatible format.

 

Example:

  Twitter's "Created At" string: Sat Dec 03 10:02:13 +0000 2016

  SQL Server datetime compatible format: 2016/Dec/03 10:02:13

 

Flow:

1. Trigger - When a new tweet is posted.

2. Action - Compose

  Name : CreatedAt

  Inputs : Twitter's "Create at" value

3. Action - Compose

  Name : CreatedAtArray

  Inputs : "@split(outputs('CreatedAt'), ' ')"

4. Action - Compose

  Name : CreatedAtDatetime

  Inputs: "@concat(outputs('CreatedAtArray')[5], '/', outputs('CreatedAtArray')[1],'/',outputs('CreatedAtArray')[2],' ',outputs('CreatedAtArray')[3])"

 

Now, CreatedAtDatetime's output can insert SQL Server's DateTime column by "SQL Server - Insert row" action.

Attention: the Double quote need Inputs for Step 3, Step 4.

and Function of Step 3, Step4 is Workflow Definition Language.

 

Regards,

Yoshihiro Kawabata

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

 

Hi yoshihirok,

 

Thanks for your sharing. Works great. 🙂

 

In addition, there is a datetime format function available, which would format the date string of step 4 into ISO 8601 format by default:

formatDateTime Returns a string in date format. The result is a string in ISO 8601 format ("o") by default, unless a format specifier is provided.

 

We could use the following method to format the date:

"@formatDateTime(concat(outputs('CreatedAtArray')[5],'/',outputs('CreatedAtArray')[1],'/',outputs('CreatedAtArray')[2],' ',outputs('CreatedAtArray')[3]),'yyyy-MM-dd hh:mm:ss')"

You could find the other function reference below:

Workflow Definition Language

 

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

 

Hi yoshihirok,

 

Thanks for your sharing. Works great. 🙂

 

In addition, there is a datetime format function available, which would format the date string of step 4 into ISO 8601 format by default:

formatDateTime Returns a string in date format. The result is a string in ISO 8601 format ("o") by default, unless a format specifier is provided.

 

We could use the following method to format the date:

"@formatDateTime(concat(outputs('CreatedAtArray')[5],'/',outputs('CreatedAtArray')[1],'/',outputs('CreatedAtArray')[2],' ',outputs('CreatedAtArray')[3]),'yyyy-MM-dd hh:mm:ss')"

You could find the other function reference below:

Workflow Definition Language

 

Regards

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, @v-micsh-msft

 

Thank you, formatDateTime() information.

 

and I hope to formatDateTime() supporting Twitter's Created At string as parameter.

 

Regards,

Yoshihiro Kawabata

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (2,396)