Skip to Content
Using SQLite
book

Using SQLite

by Jay A. Kreibich
August 2010
Intermediate to advanced
526 pages
23h 39m
English
O'Reilly Media, Inc.
Content preview from Using SQLite

Name

strftime() — Decode time string into any format

Common Usage

strftime( format, timestring, modifier1, modifier2, ... )

Description

The strftime() function returns a formatted string by taking a timestring (with modifiers) and formating it according to format , a printf() style format specification. If any of the parameters are in an incorrect or illegal format, a NULL is returned.

The format string can contain any of the following markers:

  • %d — day of the month ( DD ), 01-31

  • %f — seconds with fractional part (SS.sss), 00-59 plus decimal portion

  • %H — hour ( HH ), 00-23

  • %j — day of the year ( NNN ), 001-366

  • %J — Julian Day number (DDDDDDD.ddddddd)

  • %m — month ( MM ), 01-12

  • %M — minute ( MM ), 00-59

  • %s — seconds since 1970-01-01 (Unix epoch)

  • %S — seconds ( SS ), 00-59

  • %w — day of the week ( N ), starting with Sunday as 0

  • %W — week of the year ( WW ), 00-53

  • %Y — year ( YYYY )

  • %% — a literal %

The timestring value can be in any of these formats:

  • YYYY-MM-DD

  • YYYY-MM-DD HH:MM

  • YYYY-MM-DD HH:MM:SS

  • YYYY-MM-DD HH:MM:SS.sss

  • YYYY-MM-DDTHH:MM

  • YYYY-MM-DDTHH:MM:SS

  • YYYY-MM-DDTHH:MM:SS.sss

  • HH:MM

  • HH:MM:SS

  • HH:MM:SS.sss

  • now

  • DDDDDDD

  • DDDDDDD.ddddddd

All hour values use a 24-hour clock. Any value that is not given will be implied. Any implied hour, minute, second, or subsecond is zero. Any implied month or day of month is 1. Any implied year is 2000. The full date and time formats allow either a space or a literal uppercase T between the date and time. The last two values (a single, large integer ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Creating a Database with SQLite

Creating a Database with SQLite

Allen Taylor
Practical SQL

Practical SQL

Anthony DeBarros

Publisher Resources

ISBN: 9781449394592Errata Page