Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
44
Task/Date-format/Ada/date-format.adb
Normal file
44
Task/Date-format/Ada/date-format.adb
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
with Ada.Calendar; use Ada.Calendar;
|
||||
with Ada.Calendar.Formatting; use Ada.Calendar.Formatting;
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Date_Format is
|
||||
function Image (Month : Month_Number) return String is
|
||||
begin
|
||||
case Month is
|
||||
when 1 => return "January";
|
||||
when 2 => return "February";
|
||||
when 3 => return "March";
|
||||
when 4 => return "April";
|
||||
when 5 => return "May";
|
||||
when 6 => return "June";
|
||||
when 7 => return "July";
|
||||
when 8 => return "August";
|
||||
when 9 => return "September";
|
||||
when 10 => return "October";
|
||||
when 11 => return "November";
|
||||
when 12 => return "December";
|
||||
end case;
|
||||
end Image;
|
||||
function Image (Day : Day_Name) return String is
|
||||
begin
|
||||
case Day is
|
||||
when Monday => return "Monday";
|
||||
when Tuesday => return "Tuesday";
|
||||
when Wednesday => return "Wednesday";
|
||||
when Thursday => return "Thursday";
|
||||
when Friday => return "Friday";
|
||||
when Saturday => return "Saturday";
|
||||
when Sunday => return "Sunday";
|
||||
end case;
|
||||
end Image;
|
||||
Today : Time := Clock;
|
||||
begin
|
||||
Put_Line (Image (Today) (1..10));
|
||||
Put_Line
|
||||
( Image (Day_Of_Week (Today)) & ", "
|
||||
& Image (Ada.Calendar.Month (Today))
|
||||
& Day_Number'Image (Ada.Calendar.Day (Today)) & ","
|
||||
& Year_Number'Image (Ada.Calendar.Year (Today))
|
||||
);
|
||||
end Date_Format;
|
||||
31
Task/Date-format/AutoIt/date-format.au3
Normal file
31
Task/Date-format/AutoIt/date-format.au3
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <Date.au3>
|
||||
|
||||
$iYear = 2007
|
||||
$iMonth = 11
|
||||
$iDay = 10
|
||||
|
||||
ConsoleWrite(StringFormat('%4d-%02d-%02d', $iYear, $iMonth, $iDay) & @LF)
|
||||
|
||||
$iWeekDay = _DateToDayOfWeekISO($iYear, $iMonth, $iDay)
|
||||
ConsoleWrite(StringFormat('%s, %s %02d, %4d', _GetLongDayLocale($iWeekDay), _GetLongMonthLocale($iMonth), $iDay, $iYear) & @LF)
|
||||
|
||||
|
||||
Func _GetLongDayLocale($_iWeekDay) ; 1..7 Monday=1
|
||||
Local $aDayName[8] = [0, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30]
|
||||
Return GetLocaleInfo($aDayName[$_iWeekDay])
|
||||
EndFunc
|
||||
|
||||
Func _GetLongMonthLocale($_iMonth) ; 1..12 January=1
|
||||
Local $aMonthName[13] = [0, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43]
|
||||
Return GetLocaleInfo($aMonthName[$_iMonth])
|
||||
EndFunc
|
||||
|
||||
Func GetLocaleInfo($_LCType)
|
||||
Local $ret, $LCID, $sBuffer, $iLen
|
||||
$ret = DllCall('kernel32', 'long', 'GetSystemDefaultLCID')
|
||||
$LCID = $ret[0]
|
||||
$ret = DllCall('kernel32', 'long', 'GetLocaleInfo', 'long', $LCID, 'long', $_LCType, 'str', $sBuffer, 'long', 0)
|
||||
$iLen = $ret[0]
|
||||
$ret = DllCall('kernel32', 'long', 'GetLocaleInfo', 'long', $LCID, 'long', $_LCType, 'str', $sBuffer, 'long', $iLen)
|
||||
Return $ret[3]
|
||||
EndFunc
|
||||
64
Task/Date-format/COBOL/date-format.cob
Normal file
64
Task/Date-format/COBOL/date-format.cob
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. Date-Format.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
|
||||
01 Days-Area.
|
||||
03 Days-Data.
|
||||
05 FILLER PIC X(9) VALUE "Monday".
|
||||
05 FILLER PIC X(9) VALUE "Tuesday".
|
||||
05 FILLER PIC X(9) VALUE "Wednesday".
|
||||
05 FILLER PIC X(9) VALUE "Thursday".
|
||||
05 FILLER PIC X(9) VALUE "Friday".
|
||||
05 FILLER PIC X(9) VALUE "Saturday".
|
||||
05 FILLER PIC X(9) VALUE "Sunday".
|
||||
|
||||
03 Days-Values REDEFINES Days-Data.
|
||||
05 Days-Table PIC X(9) OCCURS 7 TIMES.
|
||||
|
||||
01 Months-Area.
|
||||
03 Months-Data.
|
||||
05 FILLER PIC X(9) VALUE "January".
|
||||
05 FILLER PIC X(9) VALUE "February".
|
||||
05 FILLER PIC X(9) VALUE "March".
|
||||
05 FILLER PIC X(9) VALUE "April".
|
||||
05 FILLER PIC X(9) VALUE "May".
|
||||
05 FILLER PIC X(9) VALUE "June".
|
||||
05 FILLER PIC X(9) VALUE "July".
|
||||
05 FILLER PIC X(9) VALUE "August".
|
||||
05 FILLER PIC X(9) VALUE "September".
|
||||
05 FILLER PIC X(9) VALUE "October".
|
||||
05 FILLER PIC X(9) VALUE "November".
|
||||
05 FILLER PIC X(9) VALUE "December".
|
||||
|
||||
03 Months-Values REDEFINES Months-Data.
|
||||
05 Months-Table PIC X(9) OCCURS 12 TIMES.
|
||||
|
||||
01 Current-Date-Str.
|
||||
03 Current-Year PIC X(4).
|
||||
03 Current-Month PIC X(2).
|
||||
03 Current-Day PIC X(2).
|
||||
|
||||
01 Current-Day-Of-Week PIC 9.
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
MOVE FUNCTION CURRENT-DATE (1:8) TO Current-Date-Str
|
||||
|
||||
DISPLAY Current-Year "-" Current-Month "-" Current-Day
|
||||
|
||||
ACCEPT Current-Day-Of-Week FROM DAY-OF-WEEK
|
||||
DISPLAY
|
||||
FUNCTION TRIM(
|
||||
Days-Table (FUNCTION NUMVAL(Current-Day-Of-Week)))
|
||||
", "
|
||||
FUNCTION TRIM(
|
||||
Months-Table (FUNCTION NUMVAL(Current-Month)))
|
||||
" "
|
||||
Current-Day
|
||||
", "
|
||||
Current-Year
|
||||
END-DISPLAY
|
||||
|
||||
GOBACK
|
||||
.
|
||||
6
Task/Date-format/Emacs-Lisp/date-format.el
Normal file
6
Task/Date-format/Emacs-Lisp/date-format.el
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(format-time-string "%Y-%m-%d")
|
||||
(format-time-string "%F") ;; new in Emacs 24
|
||||
;; => "2015-11-08"
|
||||
|
||||
(format-time-string "%A, %B %e, %Y")
|
||||
;; => "Sunday, November 8, 2015"
|
||||
11
Task/Date-format/Euphoria/date-format.eu
Normal file
11
Task/Date-format/Euphoria/date-format.eu
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
constant days = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}
|
||||
constant months = {"January","February","March","April","May","June",
|
||||
"July","August","September","October","November","December"}
|
||||
|
||||
sequence now
|
||||
|
||||
now = date()
|
||||
now[1] += 1900
|
||||
|
||||
printf(1,"%d-%02d-%02d\n",now[1..3])
|
||||
printf(1,"%s, %s %d, %d\n",{days[now[7]],months[now[2]],now[3],now[1]})
|
||||
10
Task/Date-format/Gleam/date-format.gleam
Normal file
10
Task/Date-format/Gleam/date-format.gleam
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import birl as date
|
||||
import dateformat
|
||||
import gleam/io
|
||||
|
||||
pub fn main() {
|
||||
let now = date.now()
|
||||
now |> date.to_naive_date_string |> io.println
|
||||
let assert Ok(s) = dateformat.format("dddd, MMMM D, YYYY", now)
|
||||
io.println(s)
|
||||
}
|
||||
|
|
@ -1,2 +1,9 @@
|
|||
Print str$(today, "yyyy-mm-dd")
|
||||
Print str$(today, "dddd, mmm, dd, yyyy")
|
||||
open "output.txt" for wide output as #
|
||||
Print #f, date$(today,1033)
|
||||
Print #f, date$(today, 1033,"Long Date")
|
||||
|
||||
Print #f, date$(today,1048)
|
||||
Print #f, date$(today, 1048,"Long Date")
|
||||
close #f
|
||||
Print #-2, eval$(buffer(dir$+"output.txt"))
|
||||
win dir$+"output.txt" ' or Win "notepad", dir$+"output.txt"
|
||||
|
|
|
|||
14
Task/Date-format/Odin/date-format.odin
Normal file
14
Task/Date-format/Odin/date-format.odin
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
import "core:fmt"
|
||||
import "core:time"
|
||||
|
||||
main :: proc() {
|
||||
now := time.now()
|
||||
year, month, day := time.date(now)
|
||||
|
||||
weekday := time.weekday(now)
|
||||
|
||||
fmt.printfln("%d-%2d-%2d", year, month, day)
|
||||
fmt.printfln("%s, %s %2d, %d", weekday, month, day, year)
|
||||
}
|
||||
2
Task/Date-format/Pluto/date-format.pluto
Normal file
2
Task/Date-format/Pluto/date-format.pluto
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
print(os.date("%F"))
|
||||
print(os.date("%A, %B %e, %Y"))
|
||||
5
Task/Date-format/PowerShell/date-format.ps1
Normal file
5
Task/Date-format/PowerShell/date-format.ps1
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"{0:yyyy-MM-dd}" -f (Get-Date)
|
||||
"{0:dddd, MMMM d, yyyy}" -f (Get-Date)
|
||||
# or
|
||||
(Get-Date).ToString("yyyy-MM-dd")
|
||||
(Get-Date).ToString("dddd, MMMM d, yyyy")
|
||||
36
Task/Date-format/REXX/date-format.rexx
Normal file
36
Task/Date-format/REXX/date-format.rexx
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
-- 24 Sep 2025
|
||||
include Setting
|
||||
numeric digits 20
|
||||
|
||||
say 'DATE FORMAT'
|
||||
say version
|
||||
say
|
||||
say 'Below examples may be coded with full option or only first letter.'
|
||||
say 'Both uppercase and lowercase are accepted.'
|
||||
say 'Not shown here, but the Date() function also supports conversions.'
|
||||
say
|
||||
w=18
|
||||
say 'Date function...'
|
||||
say 'Default ' Left(Date(),w) 'same as Normal'
|
||||
say 'Base ' Left(Date('B'),w) 'days since Jan 1, 0001'
|
||||
say 'Days ' Left(Date('D'),w) 'days since Jan 1, this year'
|
||||
say 'European ' Left(Date('E'),w) 'dd/mm/yy'
|
||||
if Pos('ooRexx',version) > 0 then
|
||||
say 'Full ' Left(Date('F'),w) 'microsecs since Jan 1, 0001, 00:00:00 (ooRexx)'
|
||||
say 'ISO ' Left(Date('I'),w) 'yyyy-mm-dd'
|
||||
if Pos('ooRexx',version) > 0 then
|
||||
say 'Language ' Left(Date('L'),w) 'dd month yyyy (ooRexx NL)'
|
||||
say 'Month ' Left(Date('M'),w) 'Month name'
|
||||
say 'Normal ' Left(Date('N'),w) 'dd Mmm yyyy'
|
||||
say 'Ordered ' Left(Date('O'),w) 'yy/mm/dd'
|
||||
say 'Standard ' Left(Date('S'),w) 'yyyymmdd'
|
||||
say 'Ticks ' Left(Date('T'),w) 'seconds since Jan 1, 1970, 00:00:00'
|
||||
say 'USA ' Left(Date('U'),w) 'mm/dd/yy'
|
||||
say 'Weekday ' Left(Date('W'),w) 'Day of week'
|
||||
say
|
||||
say 'Task...'
|
||||
say Date('I')
|
||||
say Date('W')',' Date('M') Right(Date('S'),2)/1',' Left(Date('S'),4)
|
||||
exit
|
||||
|
||||
include Abend
|
||||
23
Task/Date-format/Rebol/date-format-1.rebol
Normal file
23
Task/Date-format/Rebol/date-format-1.rebol
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
REBOL [
|
||||
Title: "Date Formatting"
|
||||
URL: http://rosettacode.org/wiki/Date_format
|
||||
]
|
||||
|
||||
; REBOL has no built-in pictured output.
|
||||
|
||||
zeropad: func [pad n][
|
||||
n: to-string n
|
||||
insert/dup n "0" (pad - length? n)
|
||||
n
|
||||
]
|
||||
d02: func [n][zeropad 2 n]
|
||||
|
||||
print now ; Native formatting.
|
||||
|
||||
print rejoin [now/year "-" d02 now/month "-" d02 now/day]
|
||||
|
||||
print rejoin [
|
||||
pick system/locale/days now/weekday ", "
|
||||
pick system/locale/months now/month " "
|
||||
now/day ", " now/year
|
||||
]
|
||||
1
Task/Date-format/Rebol/date-format-2.rebol
Normal file
1
Task/Date-format/Rebol/date-format-2.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
print format-date-time now "dddd, mmmm d, yyyy"
|
||||
2
Task/Date-format/Rye/date-format.rye
Normal file
2
Task/Date-format/Rye/date-format.rye
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
now |format-date "Monday, January 2, 2006"
|
||||
now |format-date "2006-1-2"
|
||||
5
Task/Date-format/VBScript/date-format.vbs
Normal file
5
Task/Date-format/VBScript/date-format.vbs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
'YYYY-MM-DD format
|
||||
WScript.StdOut.WriteLine Year(Date) & "-" & Right("0" & Month(Date),2) & "-" & Right("0" & Day(Date),2)
|
||||
|
||||
'Weekday_Name, Month_Name DD, YYYY format
|
||||
WScript.StdOut.WriteLine FormatDateTime(Now,1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue