A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
4
Task/Date-format/Factor/date-format.factor
Normal file
4
Task/Date-format/Factor/date-format.factor
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
USING: formatting calendar io ;
|
||||
|
||||
now "%Y-%m-%d" strftime print
|
||||
now "%A, %B %d, %Y" strftime print
|
||||
4
Task/Date-format/Fantom/date-format.fantom
Normal file
4
Task/Date-format/Fantom/date-format.fantom
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fansh> Date.today.toLocale("YYYY-MM-DD")
|
||||
2011-02-24
|
||||
fansh> Date.today.toLocale("WWWW, MMMM DD, YYYY")
|
||||
Thursday, February 24, 2011
|
||||
2
Task/Date-format/Frink/date-format.frink
Normal file
2
Task/Date-format/Frink/date-format.frink
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
println[now[] -> ### yyyy-MM-dd ###]
|
||||
println[now[] -> ### EEEE, MMMM d, yyyy ###]
|
||||
2
Task/Date-format/Groovy/date-format-1.groovy
Normal file
2
Task/Date-format/Groovy/date-format-1.groovy
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def isoFormat = { date -> date.format("yyyy-MM-dd") }
|
||||
def longFormat = { date -> date.format("EEEE, MMMM dd, yyyy") }
|
||||
3
Task/Date-format/Groovy/date-format-2.groovy
Normal file
3
Task/Date-format/Groovy/date-format-2.groovy
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
def now = new Date()
|
||||
println isoFormat(now)
|
||||
println longFormat(now)
|
||||
13
Task/Date-format/HicEst/date-format-1.hicest
Normal file
13
Task/Date-format/HicEst/date-format-1.hicest
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
CHARACTER string*40
|
||||
|
||||
WRITE(Text=string, Format='UCCYY-MM-DD') 0 ! string: 2010-03-13
|
||||
|
||||
! the U-format to write date and time uses ',' to separate additional output formats
|
||||
! we therefore use ';' in this example and change it to ',' below:
|
||||
WRITE(Text=string,Format='UWWWWWWWWW; MM DD; CCYY') 0 ! string = "Saturday ; 03 13; 2010"
|
||||
READ(Text=string) month ! first numeric value = 3 (no literal month name available)
|
||||
EDIT(Text='January,February,March,April,May,June,July,August,September,October,November,December', ITeM=month, Parse=cMonth) ! cMonth = "March"
|
||||
! change now string = "Saturday ; 03 13; 2010" to "Saturday, March 13, 2010":
|
||||
EDIT(Text=string, Right=' ', Mark1, Right=';', Right=3, Mark2, Delete, Insert=', '//cMonth, Right=';', RePLaceby=',')
|
||||
|
||||
END
|
||||
4
Task/Date-format/HicEst/date-format-2.hicest
Normal file
4
Task/Date-format/HicEst/date-format-2.hicest
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
procedure main()
|
||||
write(map(&date,"/","-"))
|
||||
write(&dateline ? tab(find(&date[1:5])+4))
|
||||
end
|
||||
2
Task/Date-format/J/date-format-1.j
Normal file
2
Task/Date-format/J/date-format-1.j
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
6!:0 'YYYY-MM-DD'
|
||||
2010-08-19
|
||||
6
Task/Date-format/J/date-format-2.j
Normal file
6
Task/Date-format/J/date-format-2.j
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
require 'dates system/packages/misc/datefmt.ijs'
|
||||
days=:;:'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'
|
||||
fmtDate=: [:((days ;@{~ weekday),', ',ms0) 3 {.]
|
||||
|
||||
fmtDate 6!:0 ''
|
||||
Thursday, August 19, 2010
|
||||
9
Task/Date-format/Joy/date-format.joy
Normal file
9
Task/Date-format/Joy/date-format.joy
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
DEFINE weekdays == [ "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday" ];
|
||||
months == [ "January" "February" "March" "April" "May" "June" "July" "August"
|
||||
"September" "October" "November" "December" ].
|
||||
|
||||
time localtime [ [0 at 'd 4 4 format] ["-"] [1 at 'd 2 2 format] ["-"] [2 at 'd 2 2 format] ]
|
||||
[i] map [putchars] step '\n putch pop.
|
||||
|
||||
time localtime [ [8 at pred weekdays of] [", "] [1 at pred months of] [" "] [2 at 'd 1 1 format]
|
||||
[", "] [0 at 'd 4 4 format] ] [i] map [putchars] step '\n putch pop.
|
||||
23
Task/Date-format/Liberty-BASIC/date-format.liberty
Normal file
23
Task/Date-format/Liberty-BASIC/date-format.liberty
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
'Display the current date in the formats of "2007-11-10"
|
||||
d$=date$("yyyy/mm/dd")
|
||||
print word$(d$,1,"/")+"-"+word$(d$,2,"/")+"-"+word$(d$,3,"/")
|
||||
|
||||
'and "Sunday, November 10, 2007".
|
||||
day$(0)="Tuesday"
|
||||
day$(1)="Wednesday"
|
||||
day$(2)="Thursday"
|
||||
day$(3)="Friday"
|
||||
day$(4)="Saturday"
|
||||
day$(5)="Sunday"
|
||||
day$(6)="Monday"
|
||||
theDay = date$("days") mod 7
|
||||
print day$(theDay);", ";date$()
|
||||
|
||||
' month in full
|
||||
year=val(word$(d$,1,"/"))
|
||||
month=val(word$(d$,2,"/"))
|
||||
day=val(word$(d$,3,"/"))
|
||||
weekDay$="Tuesday Wednesday Thursday Friday Saturday Sunday Monday"
|
||||
monthLong$="January February March April May June July August September October November December"
|
||||
|
||||
print word$(weekDay$,theDay+1);", ";word$(monthLong$,month);" ";day;", ";year
|
||||
4
Task/Date-format/MUMPS/date-format-1.mumps
Normal file
4
Task/Date-format/MUMPS/date-format-1.mumps
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
DTZ
|
||||
WRITE !,"Date format 3: ",$ZDATE($H,3)
|
||||
WRITE !,"Or ",$ZDATE($H,12),", ",$ZDATE($H,9)
|
||||
QUIT
|
||||
21
Task/Date-format/MUMPS/date-format-2.mumps
Normal file
21
Task/Date-format/MUMPS/date-format-2.mumps
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
DTM(H)
|
||||
;You can pass an integer, but the default is to use today's value
|
||||
SET:$DATA(H)=0 H=$HOROLOG
|
||||
NEW Y,YR,RD,MC,MO,DA,MN,DN,DOW
|
||||
SET MN="January,February,March,April,May,June,July,August,September,October,November,December"
|
||||
SET DN="Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"
|
||||
SET MC="31,28,31,30,31,30,31,31,30,31,30,31"
|
||||
SET Y=+H\365.25 ;This shouldn't be an approximation in production code
|
||||
SET YR=Y+1841 ;Y is the offset from the epoch in years
|
||||
SET RD=((+H-(Y*365.25))+1)\1 ;How far are we into the year?
|
||||
SET $P(MC,",",2)=$S(((YR#4=0)&(YR#100'=0))!((YR#100=0)&(YR#400=0))=0:28,1:29) ;leap year correction
|
||||
SET MO=1,RE=RD FOR QUIT:RE<=$P(MC,",",MO) SET RE=RE-$P(MC,",",MO),MO=MO+1
|
||||
SET DA=RE+1
|
||||
SET DOW=(H#7)+5 ;Fencepost issue - the first piece is 1
|
||||
;add padding as needed
|
||||
SET:$L(MO)<2 MO="0"_MO
|
||||
SET:$L(DA)<2 DA="0"_DA
|
||||
WRITE !,YR,"-",MO,"-",DA
|
||||
WRITE !,$P(DN,",",DOW),", ",$P(MN,",",MO)," ",DA,", ",YR
|
||||
KILL Y,YR,RD,MC,MO,DA,MN,DN,DOW
|
||||
QUIT
|
||||
2
Task/Date-format/Mathematica/date-format.mathematica
Normal file
2
Task/Date-format/Mathematica/date-format.mathematica
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
DateString[{"Year", "-", "Month", "-", "Day"}]
|
||||
DateString[{"DayName", ", ", "MonthName", " ", "Day", ", ", "Year"}]
|
||||
Loading…
Add table
Add a link
Reference in a new issue