MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / CVT_string_to_datetime

Function CVT_string_to_datetime

src/common/cvt.cpp:603–1120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601
602
603void CVT_string_to_datetime(const dsc* desc,
604 ISC_TIMESTAMP_TZ* date, bool* timezone_present,
605 const EXPECT_DATETIME expect_type, bool allow_special, Callbacks* cb)
606{
607/**************************************
608 *
609 * s t r i n g _ t o _ d a t e t i m e
610 *
611 **************************************
612 *
613 * Functional description
614 * Convert an arbitrary string to a date and/or time.
615 *
616 * String must be formed using ASCII characters only.
617 * Conversion routine can handle the following input formats
618 * "now" current date & time
619 * "today" Today's date 0:0:0.0 time
620 * "tomorrow" Tomorrow's date 0:0:0.0 time
621 * "yesterday" Yesterday's date 0:0:0.0 time
622 * YYYY-MM-DD [HH:[Min:[SS.[Thou]]]]]
623 * MM:DD[:YY [HH:[Min:[SS.[Thou]]]]]
624 * DD.MM[:YY [HH:[Min:[SS.[Thou]]]]]
625 * Where:
626 * DD = 1 .. 31 (Day of month)
627 * YY = 00 .. 99 2-digit years are converted to the nearest year
628 * in a 50 year range. Eg: if this is 1996
629 * 96 ==> 1996
630 * 97 ==> 1997
631 * ...
632 * 00 ==> 2000
633 * 01 ==> 2001
634 * ...
635 * 44 ==> 2044
636 * 45 ==> 2045
637 * 46 ==> 1946
638 * 47 ==> 1947
639 * ...
640 * 95 ==> 1995
641 * If the current year is 1997, then 46 is converted
642 * to 2046 (etc).
643 * = 100.. 5200 (Year)
644 * MM = 1 .. 12 (Month of year)
645 * = "JANUARY"... (etc)
646 * HH = 0 .. 23 (Hour of day)
647 * Min = 0 .. 59 (Minute of hour)
648 * SS = 0 .. 59 (Second of minute - LEAP second not supported)
649 * Thou = 0 .. 9999 (Fraction of second)
650 * HH, Min, SS, Thou default to 0 if missing.
651 * YY defaults to current year if missing.
652 * Note: ANY punctuation can be used instead of : (eg: / - etc)
653 * Using . (period) in either of the first two separation
654 * points will cause the date to be parsed in European DMY
655 * format.
656 * Arbitrary whitespace (space or TAB) can occur between
657 * components.
658 *
659 **************************************/
660

Callers 2

MAKE_constantFunction · 0.85
CVT_move_commonFunction · 0.85

Calls 7

CVT_make_stringFunction · 0.85
CVT_conversion_errorFunction · 0.85
GdsClass · 0.85
getSessionTimeZoneMethod · 0.45
decodeMethod · 0.45
valueMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected