Date Functions
3 min
about the methods used to calculate time periods there are two ways to calculate when a time period has passed the boundary crossing method and the whole interval method with the boundary crossing method, the application considers a time period has passed whenever you cross over the boundary for example, if you are calculating days, the boundary is midnight if you start a process at 11 58 pm and end at 12 02 am the next day, using the boundary crossing method, the application considers that a day has passed, even though the process took only four minutes with the whole interval method, the application considers a time period has passed whenever a whole interval has passed for example, if you are calculating days, the whole interval is one full day, or 24 hours if you start a process at 11 58 pm today, the application only considers a day to pass after 11 58 pm tomorrow that is, after 24 hours have passed when calculating months, if you are going from a longer month (such as august, which has 31 days) to a shorter month (such as september which has 30 days), and you start the interval on a day of the month in the longer month that does not exist in the shorter month (for example, if you start the interval on august 31), the application considers the interval to have passed on the last day of the next month (for example, on september 30) microsoft sql server rules use the boundary crossing method about time zones many date functions have a timezone parameter this parameter specifies time zones as they appear in the iana time zone database format see working with dates, times, and time zones docid 5wbikekjggbtk efy2jmy for more information rarely, the result of certain functions can vary depending on your time zone for the diffdays() , diffhours() , diffminutes() , diffmonths() , diffquarters() , diffseconds() , diffweeks() , and diffyears() functions, the functions calculate the number of whole intervals in the current time zone, even though it returns utc normally, a day is 24 hours, but occasionally there are 23 or 25 hour days when daylight savings time begins or ends so on those days, you would need to pass 23 or 25 hours to pass a whole interval list of functions adddays docid\ rahkfpv1ds4qs 4gg4zupaddhours docid\ q6eohjl08hshuf1e77tsfaddminutes docid\ ily5d8nulahvt472qer54addmonths docid wec gmzrxbus0ogbwkwbaddquarters docid\ ofnooijjqcqfuy72 hj2iaddseconds docid\ mk1aigwweju p8t36mbsyaddweeks docid\ zhlhxsklobixn5jr77ez8addyears docid\ ppvyktkiilklmgfrb26hxbeginningofday docid\ cr8fqevd4pm6fxs96sf1 beginningofhour docid\ naoimdxg42pmhbhz s8zubeginningofminute docid\ c3vz4la2rksk3vtjahoqubeginningofmonth docid\ xnhtkibjkyzu1igzosjembeginningofquarter docid 3qn39xyfjn4ukvm1risb1beginningofweek docid\ uxc5mlv8sdbb aaoe6nbbbeginningofyear docid\ ld6ulknjuiztcjfuvu nyctimetodatetime docid\ h hhjzwesc2fefe1pnimcurrentdate docid\ jbywj1rpdlcmqd icksbicurrentdatestr docid\ xoupklgeylzwfcak7xavqcurrentdatetime docid\ eyhz0miyphmf2bl 9kgapdatediffsql docid\ fj1arqgi0 ebta6hctp3edatetimetoctime docid\ fklfbjkourjc2tlt2wbfoday docid\ dhjrwf0kamg9m tha egudiffdays docid\ clx9jozphkeqn3doieigzdiffhours docid 8dfwkxkowasnzzgo2tpyldiffminutes docid\ keset2bre7430 eqnhpqbdiffmonths docid\ m er0 qebuxs2xqss25ridiffquarters docid\ rwc2kygmei7fru1qqyrbldiffseconds docid\ tjda2ukjijk8fai45hnk8diffweeks docid\ yas26vokpzpzztkn2 vtndiffyears docid\ bzokjvccelavtxf7ahomcendofday docid\ qpe7c44 bwfzhxv2hg5jgendofhour docid il8twbesszfvnitm2q6bendofminute docid\ k5ijvjpgv1vaafuuzrvzsendofmonth docid 3qea3vhe0olbz2mbc8imlendofquarter docid\ xr6wrbynzo8queyqb0 xpendofweek docid\ fwod58bvvovwuawtta5ruendofyear docid\ xyxytw n5kppbp9obkuuformatdate docid\ do8fpvxt yh9q2j31dyxhinterval docid\ uo9l vphu38u vrg6yrqlisvaliddate docid\ psqx6h33hwqq8z8sfhkhxisvaliddatetime docid\ tr jo4rybnuwfurjzha0klocalday docid\ jztpnmyzle10qzgw61pwmlocaldayofweek docid 8q3jjbzzydvwrl00irog localdayofyear docid\ crjtakmu73m098yjr5wzvlocalhour docid\ ezfxnbw2evf4zofemgf 7localminute docid hlylgul6zpwtdea0agbqlocalmonth docid\ ngzqpnezjocan 9e8vowylocalquarter docid\ ksxzn5u2wucfh3reo2b3ulocalsecond docid 4p2u6cutcd3getw3kzmeulocalweek docid\ vyrb8tzlecqco8ovsuiwflocalyear docid\ iuh dhnmqhxsmthas0hk6month docid\ tanieuiz8ybvpygsg8iaunow docid\ lg51htvb0yxfaonanh hkquarter docid\ fkkbph6aku y9duk6ieqrrelativedate docid\ jv0ftzpo7gw5dfhxija2 secondstotime docid\ wyfmm1ixrlgd5gs8wrg gtolocal docid\ wf71o8yl2rjtkob2yee2mweek docid\ sypknbtpxssy095dhkpt year docid\ bdo8uvwbdbmmznsyceief
