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.

Domain
datetime
Category
timestamp
Casts to
TIMESTAMP
Scope
Universal

Try it

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

DuckDB

Detect
SELECT finetype('Mon Jan 15 14:30:00 2024');
-- → 'datetime.timestamp.ctime'
Cast expression
strptime({col}, '%a %b %e %H:%M:%S %Y')
-- Format: %a %b %e %H:%M:%S %Y
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS TIMESTAMP) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'datetime.timestamp.ctime';

JSON Schema

finetype schema datetime.timestamp.ctime
{
  "$id": "https://meridian.online/schemas/datetime.timestamp.ctime",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "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.",
  "examples": [
    "Mon Jan 15 14: 30: 00 2024",
    "Tue Dec 31 23: 59: 59 2019",
    "Sat Jun  1 08: 15: 30 2024"
  ],
  "maxLength": 24,
  "minLength": 24,
  "pattern": "^[A-Z][a-z]{2} [A-Z][a-z]{2} [\\s\\d]\\d \\d{2}:\\d{2}:\\d{2} \\d{4}$",
  "title": "C ctime / asctime Format",
  "type": "string",
  "x-finetype-broad-type": "TIMESTAMP",
  "x-finetype-format-string": "%a %b %e %H:%M:%S %Y",
  "x-finetype-transform": "strptime({col}, '%a %b %e %H:%M:%S %Y')"
}

Examples

Mon Jan 15 14:30:00 2024Tue Dec 31 23:59:59 2019Sat Jun 1 08:15:30 2024

Aliases

asctime