FIND YOUR NEXT FEW LINES

Results for “date_trunc”

Small, practical examples. Search by task or narrow things down below.

260 snippets foundClear filters
CStrings

Copy text into a fixed buffer

Use snprintf and check for truncation when copying a C string.

C✓ Tested
TypeScriptCollections & records

Count words using a Map

Update a keyed counter without losing its value type.

Map✓ Tested
Linux CommandsFiles & permissions

Create an empty file

Linux Commands: Use touch to create a file when absent; an existing file keeps its contents but gets updated timestamps.

Linux Commands✓ Tested
Arduino / CArrays & embedded state

Dispatch a command through function pointers

Arduino / C: A small function table can map validated command indices to actions.

Arduino / C✓ Tested
PythonText validation & encoding

Extract named regex fields

Python: Use named capture groups to parse a known date-shaped identifier.

Python✓ Tested
PythonStrings & dates

Extract numbers from text

Find all runs of ASCII digits in a string and convert the matches to integers.

regex✓ Tested
C#Data & dates

Format a decimal amount

Use invariant culture to print a C# decimal with two places.

C#✓ Tested
JavaNumbers & dates

Format a decimal number

Format a Java decimal with two digits and a fixed locale.

Java✓ Tested
SQLiteDates & time

Format a timestamp

Extract a year and month from ISO timestamp text.

strftime✓ Tested
PostgresDates & series

Generate a sequence of numbers

Create rows without a stored table.

generate_series✓ Tested
jQueryEvents

Handle a button click

Attach a jQuery click handler to update text.

jQuery✓ Tested
C#Asynchronous work & URI handling

Increment a shared counter atomically

C#: Interlocked performs an indivisible update without a separate lock for this operation.

C#✓ Tested