ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

Finding Total Number of Day based on provided Date using RegEx?

rockeylearning
Astéroïde

Hi!

Is there a way to find total number of day of the year based on the provided date? For example, if today is 4/20, then the number of day so far is 110 of 365, if 4/21 then 111 and so on. 

 

I can use datediff to find the number of day, but since I don't have a begin date (or two date to begin with), and the year will change as time change, so how do I find this with regex?

 

Thank you in advance for your help!

5 RÉPONSES 5
nagakavyasri
Quasar

one way of doing:Screenshot 2023-04-20 175313.png

martinding
Pulsar

Hi @rockeylearning,

 

I am not sure how to calculate this in RegEx, but you can definitely try this DateTime functoin approach:

martinding_0-1682027994478.png

 

Yoshiro_Fujimori
16 - Nebula
16 - Nebula

Hi @rockeylearning ,

 

You can also use Specifier "%j" in DateTimeFormat() function.

https://help.alteryx.com/20223/designer/datetime-functions#specifiers

Yoshiro_Fujimori_0-1682031821035.png

 

Sample Workflow

Yoshiro_Fujimori_0-1682032142588.png

 

Formula

DaysOfYear = ToNumber(DateTimeFormat([Date],"%j"))

 

Output

Yoshiro_Fujimori_1-1682032164854.png

 

Qiu
21 - Polaris
21 - Polaris

@Yoshiro_Fujimori 
Nice one!

rockeylearning
Astéroïde

Thank you, everyone! These all are great solutions. 

Étiquettes
Auteurs des meilleures solutions