blob: 91b18dc72d2a1788116c18b499fe790e00d12566 [file] [log] [blame]
"use strict";(self.webpackChunkdoris_website=self.webpackChunkdoris_website||[]).push([[34141],{15680:(e,n,t)=>{t.d(n,{xA:()=>m,yg:()=>f});var r=t(296540);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),c=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},m=function(e){var n=c(e.components);return r.createElement(l.Provider,{value:n},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),u=c(t),d=o,f=u["".concat(l,".").concat(d)]||u[d]||p[d]||i;return t?r.createElement(f,a(a({ref:n},m),{},{components:t})):r.createElement(f,a({ref:n},m))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s[u]="string"==typeof e?e:o,a[1]=s;for(var c=2;c<i;c++)a[c]=t[c];return r.createElement.apply(null,a)}return r.createElement.apply(null,t)}d.displayName="MDXCreateElement"},315223:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=t(58168),o=(t(296540),t(15680));const i={title:"FROM_SECOND",language:"en"},a=void 0,s={unversionedId:"sql-manual/sql-functions/date-time-functions/from-second",id:"version-2.0/sql-manual/sql-functions/date-time-functions/from-second",title:"FROM_SECOND",description:"\x3c!--",source:"@site/versioned_docs/version-2.0/sql-manual/sql-functions/date-time-functions/from-second.md",sourceDirName:"sql-manual/sql-functions/date-time-functions",slug:"/sql-manual/sql-functions/date-time-functions/from-second",permalink:"/docs/2.0/sql-manual/sql-functions/date-time-functions/from-second",draft:!1,tags:[],version:"2.0",frontMatter:{title:"FROM_SECOND",language:"en"},sidebar:"docs",previous:{title:"TO_MONDAY",permalink:"/docs/2.0/sql-manual/sql-functions/date-time-functions/to-monday"},next:{title:"FROM_UNIXTIME",permalink:"/docs/2.0/sql-manual/sql-functions/date-time-functions/from-unixtime"}},l={},c=[{value:"from_second",id:"from_second",level:2},{value:"description",id:"description",level:3},{value:"syntax",id:"syntax",level:4},{value:"example",id:"example",level:3},{value:"keywords",id:"keywords",level:3}],m={toc:c},u="wrapper";function p(e){let{components:n,...t}=e;return(0,o.yg)(u,(0,r.A)({},m,t,{components:n,mdxType:"MDXLayout"}),(0,o.yg)("h2",{id:"from_second"},"from_second"),(0,o.yg)("h3",{id:"description"},"description"),(0,o.yg)("h4",{id:"syntax"},"syntax"),(0,o.yg)("p",null,(0,o.yg)("inlineCode",{parentName:"p"},"DATETIME FROM_SECOND(BIGINT unix_timestamp)"),"\n",(0,o.yg)("inlineCode",{parentName:"p"},"DATETIME FROM_MILLISECOND(BIGINT unix_timestamp)"),"\n",(0,o.yg)("inlineCode",{parentName:"p"},"DATETIME FROM_MICROSECOND(BIGINT unix_timestamp)")),(0,o.yg)("p",null,"Converts a timestamp to its DATETIME represent, with argument as an integer and returned as a DATETIME type. Returns ",(0,o.yg)("inlineCode",{parentName:"p"},"NULL")," if ",(0,o.yg)("inlineCode",{parentName:"p"},"unix_timestamp < 0")," or if the function result is greater than ",(0,o.yg)("inlineCode",{parentName:"p"},"9999-12-31 23:59:59.999999"),"."),(0,o.yg)("h3",{id:"example"},"example"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},"mysql> set time_zone='Asia/Shanghai';\n\nmysql> select from_second(-1);\n+---------------------------+\n| from_second(-1) |\n+---------------------------+\n| NULL |\n+---------------------------+\n\nmysql> select from_millisecond(12345678);\n+----------------------------+\n| from_millisecond(12345678) |\n+----------------------------+\n| 1970-01-01 11:25:45.678 |\n+----------------------------+\n\nmysql> select from_microsecond(253402271999999999);\n+--------------------------------------+\n| from_microsecond(253402271999999999) |\n+--------------------------------------+\n| 9999-12-31 23:59:59.999999 |\n+--------------------------------------+\n\nmysql> select from_microsecond(253402272000000000);\n+--------------------------------------+\n| from_microsecond(253402272000000000) |\n+--------------------------------------+\n| NULL |\n+--------------------------------------+\n")),(0,o.yg)("h3",{id:"keywords"},"keywords"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},"FROM_SECOND,FROM,SECOND,MILLISECOND,MICROSECOND\n")))}p.isMDXComponent=!0}}]);