TinyDateTime



  • Turn your Mac into an air traffic radar and see airplane traffic around the world move in real-time. Discover why millions are already using Flightradar24. We are frequently featured in the media and recent media mentions include Bild (Germany), Le Monde (France), Cable News Network (US), and MSNBC (US).
  • Trusted Mac download EchoBoy 4.1.8. Virus-free and 100% clean download. Get EchoBoy alternative downloads.
  • Unfortunately, there is no direct download for the Mac version of TinyDateTime. To download the product, proceed to the App Store via the link below.
  • If you have always been dissatisfied with it, then you should now try TinyDateTime. The program informs you with a small icon about the day and time. The information is displayed extra in a small font to save you space in your menu bar. In addition, TinyDateTime provides quick access to a monthly calendar including the week of year.
  1. Tiny Date Stamp
  2. Tinydate
  3. Tiny Date Picker
  4. Perl Datetime Tiny

Mar 20, 2012 A surprise when querying Time using Access (2007) from MS SQL Server (2005) table via ODBC. SQL Server DateTime field. Access Zero Date used as the date component so Access automatically shows the time only in the linked table. This field cannot be sensibly queried by Access.

  • DESCRIPTION
  • METHODS
  • SUPPORT

DateTime::Tiny - A date object, with as little code as possible

version 1.07

DateTime::Tiny is a most prominent member of the DateTime::Tiny suite of time modules.

It implements an extremely lightweight object that represents a datetime.

The Tiny Mandate

Many CPAN modules which provide the best implementation of a certain concepts are very large. For some reason, this generally seems to be about 3 megabyte of ram usage to load the module.

For a lot of the situations in which these large and comprehensive implementations exist, some people will only need a small fraction of the functionality, or only need this functionality in an ancillary role.

The aim of the Tiny modules is to implement an alternative to the large module that implements a useful subset of their functionality, using as little code as possible.

Typically, this means a module that implements between 50% and 80% of the features of the larger module (although this is just a guideline), but using only 100 kilobytes of code, which is about 1/30th of the larger module.

The Concept of Tiny Date and Time

Due to the inherent complexity, Date and Time is intrinsically very difficult to implement properly.

The arguably only module to implement it completely correct is DateTime. However, to implement it properly DateTime is quite slow and requires 3-4 megabytes of memory to load.

The challenge in implementing a Tiny equivalent to DateTime is to do so without making the functionality critically flawed, and to carefully select the subset of functionality to implement.

If you look at where the main complexity and cost exists, you will find that it is relatively cheap to represent a date or time as an object, but much much more expensive to modify, manipulate or convert the object.

As a result, DateTime::Tiny provides the functionality required to represent a date as an object, to stringify the date and to parse it back in, but does not allow you to modify the dates.

The purpose of this is to allow for date object representations in situations like log parsing and fast real-time type work.

The problem with this is that having no ability to modify date limits the usefulness greatly.

To make up for this, if you have DateTime installed, any DateTime::Tiny module can be inflated into the equivalent DateTime as needing, loading DateTime on the fly if necessary.

This is somewhat similar to DateTime::LazyInit, but unlike that module DateTime::Tiny objects are not modifiable.

For the purposes of date/time logic, all DateTime::Tiny objects exist in the 'C' locale, and the 'floating' time zone. This may be improved in the future if a suitably tiny way of handling timezones is found.

When converting up to full DateTime objects, these locale and time zone settings will be applied (although an ability is provided to override this).

In addition, the implementation is strictly correct and is intended to be very easily to sub-class for specific purposes of your own.

In general, the intent is that the API be as close as possible to the API for DateTime. Except, of course, that this module implements less of it.

Date

new

The new constructor creates a new DateTime::Tiny object.

It takes six named parameters. day should be the day of the month (1-31), month should be the month of the year (1-12), year as a 4 digit year. hour should be the hour of the day (0-23), minute should be the minute of the hour (0-59) and second should be the second of the minute (0-59).

These are the only parameters accepted.

Returns a new DateTime::Tiny object.

now

The now method creates a new date object for the current date.

The date created will be based on localtime, despite the fact that the date is created in the floating time zone.

Returns a new DateTime::Tiny object.

year

The year accessor returns the 4-digit year for the date.

month

The month accessor returns the 1-12 month of the year for the date.

day

The day accessor returns the 1-31 day of the month for the date.

hour

The hour accessor returns the hour component of the time as an integer from zero to twenty-three (0-23) in line with 24-hour time.

minute

The minute accessor returns the minute component of the time as an integer from zero to fifty-nine (0-59).

second

The second accessor returns the second component of the time as an integer from zero to fifty-nine (0-59).

ymdhms

The ymdhms method returns the most common and accurate stringified date format, which returns in the form '2006-04-12T23:59:59'.

from_string

The from_string method creates a new DateTime::Tiny object from a string.

The string is expected to be an ISO 8601 combined date and time, with separators (including the 'T' separator) and no time zone designator. No other ISO 8601 formats are supported.

Returns a new DateTime::Tiny object, or throws an exception on error.

as_string

The as_string method converts the date to the default string, which at present is the same as that returned by the ymdhms method above.

This string conforms to the ISO 8601 standard for the encoding of a combined date and time as a string, without time-zone designator.

DateTime

Tiny Date Stamp

The DateTime method is used to create a DateTime object that is equivalent to the DateTime::Tiny object, for use in conversions and calculations.

As mentioned earlier, the object will be set to the 'C' locale, and the 'floating' time zone.

If installed, the DateTime module will be loaded automatically.

Returns a DateTime object, or throws an exception if DateTime is not installed on the current host.

This module was written by Adam Kennedy in 2006. In 2016, David Golden adopted it as a caretaker maintainer.

Tiny

DateTime, Date::Tiny, Time::Tiny, Config::Tiny, ali.as

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at https://github.com/dagolden/DateTime-Tiny/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

  • Adam Kennedy <adamk@cpan.org>

  • David Golden <dagolden@cpan.org>

  • Ken Williams <Ken.Williams@WindLogics.com>

  • Nigel Gregoire <nigelg@airg.com>

  • Ovid <curtis_ovid_poe@yahoo.com>

This software is copyright (c) 2006 by Adam Kennedy.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Tiny date picker

To install DateTime::Tiny, copy and paste the appropriate command in to your terminal.

For more information on module installation, please visit the detailed CPAN module installation guide.

-->

Applies to: SQL Server (all supported versions) Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics

The sections in this topic cover all Transact-SQL date and time data types and functions.

  • Date and Time Functions

Date and Time data types

The Transact-SQL date and time data types are listed in the following table:

Data typeFormatRangeAccuracyStorage size (bytes)User-defined fractional second precisionTime zone offset
timehh:mm:ss[.nnnnnnn]00:00:00.0000000 through 23:59:59.9999999100 nanoseconds3 to 5YesNo
dateYYYY-MM-DD0001-01-01 through 9999-12-311 day3NoNo
smalldatetimeYYYY-MM-DD hh:mm:ss1900-01-01 through 2079-06-061 minute4NoNo
datetimeYYYY-MM-DD hh:mm:ss[.nnn]1753-01-01 through 9999-12-310.00333 second8NoNo
datetime2YYYY-MM-DD hh:mm:ss[.nnnnnnn]0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999100 nanoseconds6 to 8YesNo
datetimeoffsetYYYY-MM-DD hh:mm:ss[.nnnnnnn] [+|-]hh:mm0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999 (in UTC)100 nanoseconds8 to 10YesYes
Tinydate

Note

The Transact-SQL rowversion data type is not a date or time data type. timestamp is a deprecated synonym for rowversion.

Date and Time functions

The following tables list the Transact-SQL date and time functions. See Deterministic and Nondeterministic Functions for more information about determinism.

Function That Return System Date and Time Values

Transact-SQL derives all system date and time values from the operating system of the computer on which the instance of SQL Server runs.

Higher-Precision System Date and Time Functions

SQL Server 2019 (15.x) derives the date and time values through use of the GetSystemTimeAsFileTime() Windows API. The accuracy depends on the computer hardware and version of Windows on which the instance of SQL Server running. This API has a precision fixed at 100 nanoseconds. Use the GetSystemTimeAdjustment() Windows API to determine the accuracy.

Tiny date stamp
FunctionSyntaxReturn valueReturn data typeDeterminism
SYSDATETIMESYSDATETIME ()Returns a datetime2(7) value containing the date and time of the computer on which the instance of SQL Server runs. The returned value does not include the time zone offset.datetime2(7)Nondeterministic
SYSDATETIMEOFFSETSYSDATETIMEOFFSET ( )Returns a datetimeoffset(7) value containing the date and time of the computer on which the instance of SQL Server runs. The returned value includes the time zone offset.datetimeoffset(7)Nondeterministic
SYSUTCDATETIMESYSUTCDATETIME ( )Returns a datetime2(7) value containing the date and time of the computer on which the instance of SQL Server is running. The function returns the date and time values as UTC time (Coordinated Universal Time).datetime2(7)Nondeterministic

Tinydate

Lower-Precision System Date and Time Functions

FunctionSyntaxReturn valueReturn data typeDeterminism
CURRENT_TIMESTAMPCURRENT_TIMESTAMPReturns a datetime value containing the date and time of the computer on which the instance of SQL Server runs. The returned value does not include the time zone offset.datetimeNondeterministic
GETDATEGETDATE ( )Returns a datetime value containing the date and time of the computer on which the instance of SQL Server runs. The returned value does not include the time zone offset.datetimeNondeterministic
GETUTCDATEGETUTCDATE ( )Returns a datetime value containing the date and time of the computer on which the instance of SQL Server runs. The function returns the date and time values as UTC time (Coordinated Universal Time).datetimeNondeterministic

Functions That Return Date and Time Parts

FunctionSyntaxReturn valueReturn data typeDeterminism
DATENAMEDATENAME ( datepart , date )Returns a character string representing the specified datepart of the specified date.nvarcharNondeterministic
DATEPARTDATEPART ( datepart , date )Returns an integer representing the specified datepart of the specified date.intNondeterministic
DAYDAY ( date )Returns an integer representing the day part of the specified date.intDeterministic
MONTHMONTH ( date )Returns an integer representing the month part of a specified date.intDeterministic
YEARYEAR ( date )Returns an integer representing the year part of a specified date.intDeterministic

Functions That Return Date and Time Values from Their Parts

FunctionSyntaxReturn valueReturn data typeDeterminism
DATEFROMPARTSDATEFROMPARTS ( year, month, day )Returns a date value for the specified year, month, and day.dateDeterministic
DATETIME2FROMPARTSDATETIME2FROMPARTS ( year, month, day, hour, minute, seconds, fractions, precision)Returns a datetime2 value for the specified date and time, with the specified precision.datetime2(precision)Deterministic
DATETIMEFROMPARTSDATETIMEFROMPARTS ( year, month, day, hour, minute, seconds, milliseconds)Returns a datetime value for the specified date and time.datetimeDeterministic
DATETIMEOFFSETFROMPARTSDATETIMEOFFSETFROMPARTS ( year, month, day, hour, minute, seconds, fractions, hour_offset, minute_offset, precision)Returns a datetimeoffset value for the specified date and time, with the specified offsets and precision.datetimeoffset(precision)Deterministic
SMALLDATETIMEFROMPARTSSMALLDATETIMEFROMPARTS ( year, month, day, hour, minute )Returns a smalldatetime value for the specified date and time.smalldatetimeDeterministic
TIMEFROMPARTSTIMEFROMPARTS ( hour, minute, seconds, fractions, precision )Returns a time value for the specified time, with the specified precision.time(precision)Deterministic

Functions That Return Date and Time Difference Values

FunctionSyntaxReturn valueReturn data typeDeterminism
DATEDIFFDATEDIFF ( datepart , startdate , enddate )Returns the number of date or time datepart boundaries, crossed between two specified dates.intDeterministic
DATEDIFF_BIGDATEDIFF_BIG ( datepart , startdate , enddate )Returns the number of date or time datepart boundaries, crossed between two specified dates.bigintDeterministic

Functions That Modify Date and Time Values

FunctionSyntaxReturn valueReturn data typeDeterminism
DATEADDDATEADD (datepart , number , date )Returns a new datetime value by adding an interval to the specified datepart of the specified date.The data type of the date argumentDeterministic
EOMONTHEOMONTH ( start_date [, month_to_add ] )Returns the last day of the month containing the specified date, with an optional offset.Return type is the type of the start_date argument, or alternately, the date data type.Deterministic
SWITCHOFFSETSWITCHOFFSET (DATETIMEOFFSET , time_zone)SWITCHOFFSET changes the time zone offset of a DATETIMEOFFSET value, and preserves the UTC value.datetimeoffset with the fractional precision of the DATETIMEOFFSETDeterministic
TODATETIMEOFFSETTODATETIMEOFFSET (expression , time_zone)TODATETIMEOFFSET transforms a datetime2 value into a datetimeoffset value. TODATETIMEOFFSET interprets the datetime2 value in local time, for the specified time_zone.datetimeoffset with the fractional precision of the datetime argumentDeterministic

Tiny Date Picker

Functions That Set or Return Session Format Functions

FunctionSyntaxReturn valueReturn data typeDeterminism
@@DATEFIRST@@DATEFIRSTReturns the current value, for the session, of SET DATEFIRST.tinyintNondeterministic
SET DATEFIRSTSET DATEFIRST { number | @number_var }Sets the first day of the week to a number from 1 through 7.Not applicableNot applicable
SET DATEFORMATSET DATEFORMAT { format | @format_var }Sets the order of the dateparts (month/day/year) for entering datetime or smalldatetime data.Not applicableNot applicable
@@LANGUAGE@@LANGUAGEReturns the name of the language in current used. @@LANGUAGE is not a date or time function. However, the language setting can affect the output of date functions.Not applicableNot applicable
SET LANGUAGESET LANGUAGE { [ N ] 'language' | @language_var }Sets the language environment for the session and system messages. SET LANGUAGE is not a date or time function. However, the language setting affects the output of date functions.Not applicableNot applicable
sp_helplanguagesp_helplanguage [ [ @language = ] 'language' ]Returns information about date formats of all supported languages. sp_helplanguage is not a date or time stored procedure. However, the language setting affects the output of date functions.Not applicableNot applicable

Perl Datetime Tiny

Functions That Validate Date and Time Values

FunctionSyntaxReturn valueReturn data typeDeterminism
ISDATEISDATE ( expression )Determines whether a datetime or smalldatetime input expression has a valid date or time value.intISDATE is deterministic only used with the CONVERT function, when the CONVERT style parameter is specified, and when style is not equal to 0, 100, 9, or 109.

Date and time-related topics

TopicDescription
FORMATReturns a value formatted with the specified format and optional culture. Use the FORMAT function for locale-aware formatting of date/time and number values as strings.
CAST and CONVERT (Transact-SQL)Provides information about the conversion of date and time values to and from string literals, and other date and time formats.
Write International Transact-SQL StatementsProvides guidelines for portability of databases and database applications that use Transact-SQL statements from one language to another, or that support multiple languages.
ODBC Scalar Functions (Transact-SQL)Provides information about ODBC scalar functions available for use in Transact-SQL statements. This includes ODBC date and time functions.
AT TIME ZONE (Transact-SQL)Provides time zone conversion.

See also