How to display a selected date in Julian calendar format
Do you have a need to display a date as a Julian Calendar date? While the date pickers cannot show this, you can display the date in Julian Calendar format in a label.
The Julian Calendar displays a date that is a combination of the year and the number of days since January 1st. Using the steps below you can display any selected date in the Julian calendar format.
1. Capture January 1st of the current year using the formula below. This will allow you to get the Julian Calendar date regardless of the year or whether it's a leap year or not.
Set(varFirstYear, DateAdd(Date(Year(Today()), Month(Today()), 1), -(Month(Today()) -1), Months))​
2. Use this switch formula in your label's text property to display your date. The switch evaluates the number of characters remaining after subtracting the difference between Jan 1st and the selected Date from 3. If the remainder is 1, a 0 is added between the year and the number of days. If the remainder is 0, nothing is added.
Switch(
3 - Len(DateDiff(varFirstYear, DatePickerX.SelectedDate, Days)),
2, Concatenate(Right(Year(varFirstYear), 2) & "00" & DateDiff(varFirstYear, DatePickerX.SelectedDate, Days) + 1),
1, Concatenate(Right(Year(varFirstYear), 2) & "0" & DateDiff(varFirstYear, DatePickerX.SelectedDate, Days) +1),
0, Concatenate(Right(Year(varFirstYear), 2) & DateDiff(varFirstYear, DatePickerX.SelectedDate, Days) +1)
)
Comments
-
How to display a selected date in Julian calendar format
Could you provide screen shoots of the fields you are using? I am new to power apps and trying to do this and having no luck. Have a Date_DataCard1 with a DataCardValue7 date picker field that I would like the label to display the Julian date based upon the date selected in this date picker.
*This post is locked for comments