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 Apps / Format date from a dat...
Power Apps
Answered

Format date from a datepicker in Julian date format

(0) ShareShare
ReportReport
Posted on by 65

Hi,

 

I am new to using Power apps.

 

I am trying to copy the date from a date picker in one datacard to another datacard and dsiplay it in Julian Date format( 21/2/22 to be displayed as 22052). I have managed to copy the date and tried using the format of "yyddd" but that displays the date as "22Mon".

 

Any help would be gratefully appreciated.

 

Thanks 

Categories:
I have the same question (0)
  • Dant7484 Profile Picture
    154 on at

    Hi,

    I tried this and it worked but is kinda ugly lol

    Set(
     _month,
     Text(
     DateTimeValue(DatePicker3.SelectedDate),
     "[$-en-GB]mm"
     )
    );
    Set(
     _day,
     Text(
     DateTimeValue(DatePicker3.SelectedDate),
     "[$-en-GB]dd"
     )
    );
    Set(
     _jDay,
     Switch(
     _month,
     "01",
     "0" & _day,
     "02",
     "0" & Value(_day)+31,
     "03",
     "0" & Value(_day)+59,
     "04",
     "0" & Value(_day)+90,
     "05",
     Value(_day)+120,
     "06",
     Value(_day)+151,
     "07",
     Value(_day)+181,
     "08",
     Value(_day)+212,
     "09",
     Value(_day)+243,
     "10",
     Value(_day)+273,
     "11",
     Value(_day)+304,
     "12",
     Value(_day)+334
     )
    );
    Set(julianDate, Text(
     DateTimeValue(DatePicker3.SelectedDate),
     "[$-en-GB]yy"
     ) & _jDay)

    If you want to use it as a number u need to convert it with Value(julianDate) otherwise you can just use it as it is to show the Julian date of the date picked. Good luck!

  • twistsd Profile Picture
    65 on at

    @Dant7484 

     

    Thanks for the reply.

     

    Where would I put that code?

     

    Thanks

  • Dant7484 Profile Picture
    154 on at

    No problem, though a good thing you replied because I just saw I forgot the leap year case (add 1 day after February).

    Put this code in the date picker OnChange :

     

    Set(
     _month,
     Text(
     DateTimeValue(DatePicker3_1.SelectedDate),
     "[$-en-GB]mm"
     )
    );
    Set(
     _day,
     Text(
     DateTimeValue(DatePicker3_1.SelectedDate),
     "[$-en-GB]dd"
     )
    );
    Set(_leapYear, If(Month(Date(Year(Now()),2,29))=2, 1, 0)); // If leap year add 1 to _jday
    Set(
     _jDay,
     Switch(
     _month,
     "01",
     "0" & _day,
     "02",
     "0" & Value(_day)+31,
     "03",
     "0" & Value(_day)+59 +_leapYear,
     "04",
     "0" & Value(_day)+90 +_leapYear,
     "05",
     Value(_day)+120 +_leapYear,
     "06",
     Value(_day)+151 +_leapYear,
     "07",
     Value(_day)+181 +_leapYear,
     "08",
     Value(_day)+212 +_leapYear,
     "09",
     Value(_day)+243 +_leapYear,
     "10",
     Value(_day)+273 +_leapYear,
     "11",
     Value(_day)+304 +_leapYear,
     "12",
     Value(_day)+334 +_leapYear
     )
    );
    Set(julianDate, Text(
     DateTimeValue(DatePicker3_1.SelectedDate),
     "[$-en-GB]yy"
     ) & _jDay)

     

     

  • Dant7484 Profile Picture
    154 on at

    Edited leap year formula 

  • twistsd Profile Picture
    65 on at

    @Dant7484 

     

    Thanks for the update.

     

    I have just tried it but it still displays the date as 22/02/2022.

     

  • Dant7484 Profile Picture
    154 on at

    Hi, are you trying to display it in another date picker? because it wouldn't work, put julianDate in a textinput to display the value if you want to test it

  • twistsd Profile Picture
    65 on at

    @Dant7484 

     

    Thanks.

    That is what I am trying to achieve. I have a datepicker to choose the date and then I want a textinput to display the value in julian date format. Could you please give me the steps I need to complete to achieve this.

     

    Thanks

     

  • Dant7484 Profile Picture
    154 on at

    Of course no problem. You might have to unlock the input in datacard to edit Default 

    PA2.pngPA1.png

  • Dant7484 Profile Picture
    154 on at

    The number on the input is wrong somehow but when I picked the date its fixed idk how

  • twistsd Profile Picture
    65 on at

    @Dant7484 

     

    Thanks

     

    I have tried that but the data card for the juilan formatted input stays blank

     

    Archieve Date.pngJulian format .png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard