| import { | |
| Entity, | |
| ManyToOne, | |
| PrimaryKey, | |
| Property, | |
| type Rel, | |
| } from '@mikro-orm/core'; | |
| import { Application } from '@/modules/application/models/application.entity'; | |
| @Entity({ tableName: 'deployments' }) |
| /** | |
| * Fancy ID generator that creates 20-character string identifiers with the following properties: | |
| * | |
| * 1. They're based on timestamp so that they sort *after* any existing ids. | |
| * 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
| * 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
| * 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
| * latter ones will sort after the former ones. We do this by using the previous random bits | |
| * but "incrementing" them by 1 (only in the case of a timestamp collision). | |
| */ |
| "use client" | |
| import * as React from "react" | |
| import { buttonVariants } from "@/components/ui/button" | |
| import { ScrollArea } from "@/components/ui/scroll-area" | |
| import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" | |
| import { cn } from "@/lib/utils" | |
| import { ChevronLeft, ChevronRight } from "lucide-react" | |
| import { DayPicker, DropdownProps } from "react-day-picker" |
Working with DATE, TIMESTAMP, and INTERVAL in PostgreSQL can be confusing. In this article I will go over the three date/time related data types, and the two most useful date/time functions: DATE_PART and DATE_TRUNC. Finally, I will provide some real life examples of how these types and functions can be used within queries.
PostgreSQL Date/Time Documentation
The DATE type contains the year, month, and day of a date. It is not possible to do any type of time related functions on a DATE without first converting it to a TIMESTAMP. Subtracting two DATE values from one another results in an INT representing the # of days between.
The TIMESTAMP type contains a year, month, day, hour, minute, second, and microsecond. This is the type that I most often use.
| // based on: https://github.com/bsimic0001/AegisWallet/blob/master/mobile/src/main/java/com/aegiswallet/utils/MessagingUtils.java | |
| public class MessagingUtils { | |
| public static void main(String[] args) { | |
| System.out.println("encode: " + encode("*100#")); | |
| System.out.println("decode: " + decode("<<message to decode>>")); | |
| } | |
| /** |
| @Preview | |
| @Composable | |
| private fun DashedDividerPreview() { | |
| DashedDivider( | |
| color = Color.Black, | |
| thickness = 1.dp, | |
| modifier = Modifier | |
| .fillMaxWidth() | |
| .padding(16.dp) | |
| ) |
| @Composable | |
| fun Screen() { | |
| var date by remember { | |
| mutableStateOf( | |
| TextFieldValue( | |
| text = "dd-MM-yyyy" | |
| ) | |
| ) | |
| } |
Intro
| <!doctype html> | |
| <html><head><script src="app.js"></script></head><body></body></html> |