MeridianMERIDIAN

C ctime / asctime Format

datetime.timestamp.ctime

Output of C ctime() and asctime() functions, Python datetime.ctime(), Ruby Time#to_s. Day-of-week abbreviation, month abbreviation, space-padded day, 24-hour time, then 4-digit year.

Worked samples

DuckDB 1.5.5 · finetype 0.6.64

ValueAs TIMESTAMP
Mon Jan 15 14:30:00 20242024-01-15 14:30:00
Tue Dec 31 23:59:59 20192019-12-31 23:59:59
Sat Jun 1 08:15:30 20242024-06-01 08:15:30
%a
abbreviated weekday
%b
abbreviated month name
%-d
day, no padding
%H
hour, 24-hour clock
%M
minutes
%S
seconds
%Y
four-digit year

Written by

  • Python datetime.ctime()

Shape

Pattern
^[A-Z][a-z]{2} [A-Z][a-z]{2} [\s\d]\d \d{2}:\d{2}:\d{2} \d{4}$
ValueLengthShape
Mon Jan 15 14:30:00 202424matches
Tue Dec 31 23:59:59 201924matches
Sat Jun 1 08:15:30 202424matches
Mon Jan 15 14:30:00 20223rejected: one character short

Background

Origin

The FreeBSD manual records that the asctime() function first appeared in Version 5 AT&T UNIX.[1] The asctime() and ctime() functions were standardised in C89 and POSIX.1-1988.[2] The Linux manual page states that the call ctime(t) is equivalent to asctime(localtime(t)).[2]

POSIX defines the output of asctime() with the example string Sun Sep 16 01:03:52 1973, followed by a newline and a terminating null character.[3]

asctime() and ctime() were marked obsolescent in C23 and in POSIX.1-2008, which recommend strftime(3) instead.[2] POSIX says the asctime() function is included only for compatibility with older implementations.[3] cppreference notes that the behaviour of asctime() is undefined if the year has more than 4 digits or is less than the year 1000.[4]

Use

Python's documentation says that, unlike the C function of the same name, time.asctime() does not add a trailing newline.[5] Python's documentation says the output of datetime.ctime() will not include time zone information, whether the input is aware or naive.[6]

RFC 9110 requires a recipient that parses a timestamp in an HTTP field to accept all three HTTP-date formats.[7] RFC 9110 says values in the asctime format are assumed to be in UTC.[7]

Detection notes

New in format coverage expansion. Unix tradition format. Day may be space-padded. Python datetime.ctime(), C ctime()/asctime().

Use it

CLI · DuckDB
$ finetype infer -i "Mon Jan 15 14:30:00 2024" --mode column
→ datetime.timestamp.ctime

SELECT ft_infer('Mon Jan 15 14:30:00 2024');
-- → 'datetime.timestamp.ctime'
Cast expression
strptime({col}, '%a %b %-d %H:%M:%S %Y')
-- Format: %a %b %-d %H:%M:%S %Y

Schema

https://meridian.online/schemas/datetime.timestamp.ctime · Frictionless type datetime · any

finetype taxonomy datetime.timestamp.ctime -o json-schema

Aliases

asctime

Type Registry