As per the title, I've made my own custom setDate/setTime menu in TI-Basic for a bit of fun. It's coded so that you can never enter an invalid date, and also is programmed for leap years. I should also mention that it's hard-coded to not allow a date before May 3 2021 (today), which can obviously be changed.
I know other people (such as LogicalJoe) have said they've created programs similar to this with their own features, but here's my take on it!
And here's the code:
Code:
Feel free to try it out for yourself if you like. Also if you want to optimize/golf it be my guest! Currently sitting at 1384 bytes.
Of course, this program could be 0 bytes if you just use the OS's built in date/time editor... but that's no fun, is it?
Anyway, I hope you all like it.
Edit:
Thanks to LogicalJoe for coming up with a smaller and very clever way to create L2, so:
Code:
I know other people (such as LogicalJoe) have said they've created programs similar to this with their own features, but here's my take on it!

And here's the code:
Code:
ClrHome
augment(getDate,augment(getTime,{getTmFmt->L1
If Ans(1)+Ans(2)|E~2+Ans(3)|E~4<2021.0503
Then
2021->L1(1
5->L1(2
3->L1(3
End
{31,28,31,30,31,30,31,31,30,31,30,31->L2
{12,0,0,0,24,~1,60,~1->L3
"JanFebMarAprMayJunJulAugSepOctNovDec->Str1
"L1(4)+12(L1(7)=12)(not(L1(4))-(12<L1(4->|v
Output(1,14,"press [clear]
Output(2,18,"to cancel
Output(1,1,"Set Date:
Output(3,3,toString(L1(3
Output(4,3,toString(L1(1
Output(5,1,"Set Time:
Output(6,3,toString(|v
Output(7,3,toString(L1(5
If 12=L1(7
Output(7,7,sub("AMPM",1+2(L1(4)>11),2
Output(8,1,"Set Time Format:
Output(9,3,toString(L1(7
Output(10,2,"SAVE
DelVar B2->A
2->I
Repeat K=45 or A>9 and sum(K={21,105
If I<8
L1(I->B
If I=4
|v->B
1+(A>9->H
"SAVE
If I<8
Then
toString(B
If I=2
sub(Str1,3B-2,3
End
Output(A,2-(H=2),sub("<[",H,1)+Ans+sub(">]",H,1)+"
Repeat Ans
getKey
End
Ans->K
If K=25 and A>2 or K=34 and A<=9
Then
Output(A,2-(A>9),"
4-(A=2
If A<=9 and A>2
length(toString(B
Output(A,3+Ans-(A>9),"
Repeat Ans!=5 and Ans!=8
A+(K=34)-(K=25->A
End
Ans-3(Ans=4)-2(Ans>5->I
End
If A<=9 and sum(K={24,26
Then
If I=3
Then
L2(L1(2
If Ans=28
Ans+not(fPart(L1(1)/4
Ans->L3(3
End
L1(I)-(K=24)+(K=26
If I=1
min(2050,max(2021,Ans
If I>1 and I<6
Ans-(K-25)L3(2I-3)(Ans=L3(2I-2)+(K=26)(1+L3(2I-3
If I=7
12+12(12=L1(I
Ans->L1(I
If (I=4 or I=7) and 12=L1(7
Then
Output(7,7,sub("AMPM",1+2(L1(4)>11),2
toString(L1(4)+12(not(L1(4))-(12<L1(4
If I=7
Output(6,3,Ans+"
End
If I=7 and 24=L1(7
Then
Output(7,7,"
Output(6,3,toString(L1(4))+"
End
If L1(2)+L1(3)|E~2<5.03 and 2021=L1(1
Then
5+7(K=24 and I=2 and 5>L1(2->L1(2
Output(2,3,sub(Str1,3Ans-2,3
If L1(3)<3 and 5=L1(2
Then
3->L1(3
L2(L1(2
If Ans=28
Ans+not(fPart(L1(1)/4
If K=24 and I=3
Ans->L1(3
End
Output(3,3,toString(L1(3))+"
Else
If I<=2
Then
L2(L1(2
If Ans=28
Ans+not(fPart(L1(1)/4
If Ans<L1(3
Then
Output(3,3,Ans
Ans->L1(3
End
End
End
End
End
If K!=45
Then
setDate(L1(1),L1(2),L1(3
setTime(L1(4),L1(5),0
setTmFmt(L1(7
End
DelVar L1DelVar L2DelVar L3DelVar Str1DelVar |vClrHome
Feel free to try it out for yourself if you like. Also if you want to optimize/golf it be my guest! Currently sitting at 1384 bytes.
Of course, this program could be 0 bytes if you just use the OS's built in date/time editor... but that's no fun, is it?
Anyway, I hope you all like it.
Edit:
Thanks to LogicalJoe for coming up with a smaller and very clever way to create L2, so:
Code:
//this:
{31,28,31,30,31,30,31,31,30,31,30,31->L2
//becomes this:
0->rand
31-iPart(tanh^-1(fPart(10^(sinh(cosh(rand(12->L2