web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extracting Year using ...
Power Automate
Answered

Extracting Year using VBScript

(0) ShareShare
ReportReport
Posted on by 237

I am trying to extract the Year number from a given date

I use the Get Current Date and Time action and store the result in CurrentDate 

I then run this VB Script but get an error saying ')' expected

GanCW_0-1612220741239.png

 

Why am I getting an error ?

I have the same question (0)
  • Verified answer
    miketran13 Profile Picture
    720 on at

    Hello,

     

    You can try this: 

     

    Untitled.png

     

    Thanks and hope it can help you. 

    Mike

    ---------------------------------

    Did I answer your question? Please consider to Mark my post as a solution! to guide others

  • GanCW Profile Picture
    237 on at

    Thanks !

    So the input to VBScript should be a text datatype and not a datetime datatype.

  • miketran13 Profile Picture
    720 on at

    Yes,

     

    And you should have a double quote inside Year function as well. 

     

    Thanks and hope it can help you. 

    Mike

    ---------------------------------

    Did I answer your question? Please consider to Mark my post as a solution! to guide others

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @GanCW @miketran13 

    for this problem statement I think the VB script is not required, it can be achieved as below too:

    Divyendu_Yadav_0-1613057763190.png

     

  • GanCW Profile Picture
    237 on at

    Agree. This was more on trying to understand the interface to VBScript. Didn’t know the interface has to be text.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 253 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 172 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 134 Super User 2026 Season 2

Last 30 days Overall leaderboard