Stack Overflow for Teams — Start collaborating and sharing organizational knowledge. Create a free Team Why Teams? Learn more about Collectives. Learn more about Teams. Converting Integer to Date Ask Question. Asked 8 years, 3 months ago. Modified 4 years, 2 months ago. Viewed 32k times. I am trying to convert an integer datatype into a date.
sql sql-server. Improve this question. edited May 30, at Rahil Wazir 9, 11 11 gold badges 41 41 silver badges 63 63 bronze badges. asked May 30, at user user 5 5 gold badges 7 7 silver badges 15 15 bronze badges. What SQL database engine are you using? This would be SQL Server number of days since a date? Duplicate Question stackoverflow.
Aye, but what does the int look like? Is it ddmmyy , yyyymm , seconds since the birth of Elvis? Show 1 more comment. Sorted by: Reset to default. About Us Our team. English 日本語 한국어 Polski Română Русский Slovenščina Español Svenska ไทย Türkçe Українська Tiếng Việt Cymraeg 简体中文.
Excel Formula: Convert Number to Date Sometimes, while you import date data from other devices, it may be changed to a series number. Case 1 convert 5-digit number to date displayed. Kutools for Excel - Helps You To Stand Out From Crowd Would you like to complete your daily work quickly and perfectly?
Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands. Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes. Free upgrade and support for 2 years. Read More Download. Office Tab - Enable Tabbed Reading and Editing in Microsoft Office include Excel One second to switch between dozens of open documents! Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
Brings Efficient Tabs to Office include Excel , Just Like Chrome, Firefox, And New Internet Explorer. Oldest First. Sort comments by. Newest First. Comments 1.
No ratings yet. Be the first to rate! about 1 year ago. now or Time. To display the epoch: Time. NET Framework 4. UtcNow - new DateTime , 1, 1, 0, 0, 0, DateTimeKind. count ;. floor new Date. Unix More Go. Command line: perl -e "print time" If Perl is installed on your system. import calendar, time; calendar. timegm time. local year , month , day , hour , minute , second , usec or Time. To display add. numeric as. Example code.
SELECT extract epoch FROM date ' ' ; With timestamp: SELECT EXTRACT EPOCH FROM TIMESTAMP WITH TIME ZONE ' ' ; With interval: SELECT EXTRACT EPOCH FROM INTERVAL '5 days 3 hours' ;.
Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search. The SQL server database I'm using has a field stored as an integer but it is a date. Currently it is showing The easier way is to convert the number to a string and do a couple of SUBSTRING s.
Stack Overflow for Teams — Start collaborating and sharing organizational knowledge. Create a free Team Why Teams? Learn more about Collectives. Learn more about Teams. Convert Int data type to date Ask Question. Asked 2 years, 11 months ago. Modified 2 years, 11 months ago. Viewed times. sql-server tsql datetime. Improve this question. edited Oct 22, at Salman A k 80 80 gold badges silver badges bronze badges.
asked Oct 21, at user user Date and time datatypes don't have a format; they are binary values. If you want it to display in a specific format, you need to do that in your display layer aka your application. If the actual data type of the column is 'int', and the 'int' is stored as a number that corresponds to YYYYMMDD, then yes, that is the way to convert it to an actual 'date' format for storing. Which is, of course, completely different from a DISPLAY format. Personally, I feel the real question is: Why are you storing dates as an int in the first place?
I have no say in why it is stored that way unfortunately. How can I change the format though? When I run the code above it makes it "". Yes you can display it in another format. Google how to display a DateTime using SQL. You'll find hundreds of examples already. Add a comment. Sorted by: Reset to default. Highest score default Trending recent votes count more Date modified newest first Date created oldest first.
Improve this answer. answered Oct 21, at Salman A Salman A k 80 80 gold badges silver badges bronze badges. answered Oct 22, at Zorkolot Zorkolot 1, 1 1 gold badge 10 10 silver badges 8 8 bronze badges. Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Why the number input is the worst input. Hypergrowth headaches Ep. Planned maintenance scheduled for Wednesday, 21 September, UTC Recent Color Contrast Changes and Accessibility Updates.
The [option] tag is being burninated. Should I explain other people's code-only answers? Reviewer overboard! Or a request to improve the onboarding guidance for new Visit chat. Related Hot Network Questions. Question feed. Accept all cookies Customize settings.
Learn more about Collectives. Why the number input is the worst input. Create a free Team Why Teams? T McKeown T McKeown DynamicsCon Come join your fellow community members for an educational and engaging event in-person. My plan is to make Day, Month, Year, Hours, StartMinute a dropdown and the selected numbers of the dropdown is gonna be converted to a datetime and saved in the database. Therefore, you probably have to set StartTime in a method.combut I'm getting an error. Or a request to improve the onboarding guidance for new second The seconds 0 through The Overflow Blog. Posting as Guest.