Skip to main content

TsqlStyleCode

Enum TsqlStyleCode 

Source
pub enum TsqlStyleCode {
Show 17 variants Default100 = 100, UsaDate = 101, AnsiDate = 102, BritishDate = 103, GermanDate = 104, ItalianDate = 105, DayMonYear = 106, MonDayYear = 107, TimeOnly = 108, UsaDashes = 110, JapanDate = 111, IsoBasic = 112, TimeWithMs = 114, OdbcCanonical = 120, OdbcWithMs = 121, Iso8601 = 126, Iso8601Tz = 127,
}
Expand description

T-SQL date/time style codes used with CONVERT function.

T-SQL primarily uses numeric style codes for date formatting with CONVERT, rather than format patterns. This provides mappings for common styles.

Variants§

§

Default100 = 100

Style 100: mon dd yyyy hh:miAM (or PM)

§

UsaDate = 101

Style 101: mm/dd/yyyy (USA)

§

AnsiDate = 102

Style 102: yyyy.mm.dd (ANSI)

§

BritishDate = 103

Style 103: dd/mm/yyyy (British/French)

§

GermanDate = 104

Style 104: dd.mm.yyyy (German)

§

ItalianDate = 105

Style 105: dd-mm-yyyy (Italian)

§

DayMonYear = 106

Style 106: dd mon yyyy

§

MonDayYear = 107

Style 107: Mon dd, yyyy

§

TimeOnly = 108

Style 108: hh:mi:ss

§

UsaDashes = 110

Style 110: mm-dd-yyyy (USA with dashes)

§

JapanDate = 111

Style 111: yyyy/mm/dd (Japan)

§

IsoBasic = 112

Style 112: yyyymmdd (ISO basic)

§

TimeWithMs = 114

Style 114: hh:mi:ss:mmm

§

OdbcCanonical = 120

Style 120: yyyy-mm-dd hh:mi:ss (ODBC canonical)

§

OdbcWithMs = 121

Style 121: yyyy-mm-dd hh:mi:ss.mmm (ODBC with milliseconds)

§

Iso8601 = 126

Style 126: yyyy-mm-ddThh:mi:ss.mmm (ISO8601)

§

Iso8601Tz = 127

Style 127: yyyy-mm-ddThh:mi:ss.mmmZ (ISO8601 with timezone)

Implementations§

Source§

impl TsqlStyleCode

Source

pub fn to_format_pattern(&self) -> &'static str

Get the equivalent format pattern for a T-SQL style code.

Returns the pattern in strftime style for use in other dialects.

Source

pub fn from_code(code: i32) -> Option<Self>

Try to parse a T-SQL style code from a number.

Source

pub fn code(&self) -> i32

Get the numeric style code.

Trait Implementations§

Source§

impl Clone for TsqlStyleCode

Source§

fn clone(&self) -> TsqlStyleCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TsqlStyleCode

Source§

impl Debug for TsqlStyleCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TsqlStyleCode

Source§

impl PartialEq for TsqlStyleCode

Source§

fn eq(&self, other: &TsqlStyleCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TsqlStyleCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.