How To Convert Time Duration Format?

Jul 2, 2007

Hello, everyone:

I have a customer time duration format like "12:15" that means 12 minutes and 15 seconds. I want to convert to be "12.25 " that means 12.25 minutes. Any suggestion please. Thanks a lot.

ZYT

View 1 Replies


ADVERTISEMENT

CONVERT Datetime To Time Format.

Jun 27, 2005

I want to convert a datetime type into and speciically formatted time:the table contains this:1899-12-30 10:00:00.000I want to reformat it to appear like this:10:00 AM I want to do this with SQL using a CONVERT of something along that line.I've been able to find all kinds of date and date/time formats, but not time alone in the above format.And suggestions?TIA</chaz>

View 3 Replies View Related

Need To Convert A Date And Time To A Different Format

Jul 20, 2005

Precisely, here's what I need:When I run getdate(), I get, for example:August 9 2004 5:17 P.M.I want to turn the date portion into:8/9/2004 format and update one column with itI want to turn 5:17 P.M. into:hhmmss and update another column with it.I've been playing around with datepart, with substr, with you name it,and I'm stumped.Any code samples, other help most appreciated.Thanks,Google Jenny*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

Convert The Format Of A Date Time String Transformation....

Jul 27, 2004

Im working with a breaking system and I wont to convert the (FROM) datetime column to accept just time like (4:00:00 AM) without the date (7/23/2004) but it doesn’t have column format like the access ??
I found something in the SQL help :

How to convert the format of a Date Time String transformation (Enterprise Manager)
To convert the format of a Date Time String transformation
1.On the Transformations tab of the Transform Data Task Properties or Data Driven Query Task Properties dialog box, click the Source column containing the date or time to be modified, and then click the Destination column where you want the modified string to be placed.
2.Do one of the following:
•If there is a mapping arrow connecting the two columns, click Delete, and then click New.
•If there is no mapping arrow, click New.
3.In the Create New Transformation dialog box, click DateTime String.
4.Click the General tab, and then click Properties.
5.In the Date Format list, select the format you want.
6.Click Naming to display the Calendar Names dialog box, where you can select long or short day or month names and the A.M. and P.M. designators you want.
7.In the Language list, select the language you want, and then click Set Language Defaults.
But unfortunately I didn't find the "Transformations tab" I look a lot in the SQL Enterprise Manager

Do anybody work with the Transformations or at least know where is it please ???

View 1 Replies View Related

T-SQL (SS2K8) :: Convert Datetime To W3C Date And Time Format

Dec 21, 2014

I have a standard datetime and I need to convert it to the client specification of:

YYYY-MM-DDThh:mm:ssTZD
eg: 2009-04-16T19:20:30+08:00

I am not sure of the easiest way to do this.

The test code below gets me part of the way but I am unsure on how to get the offset on the end without hardcoding to much.

DECLARE @datetime DATETIME = '2014-12-20 12:30:00'
SELECT CONVERT(VARCHAR(30),@datetime,127)

View 2 Replies View Related

Convert Date Time(string Format) To Database Timestamp

Apr 3, 2008

I have two fields DSRHADTI which is an isodate and DSRHTIME which is 8 char time field in format 10.31.00. I want to take both these fields and put them into a field that is database timestamp so I have converted DSRHDATI to 10 character field. I am then trying to use substring to put both into 18 character field using derived column transformation editor. but it does not like the below. It's red syntax error what am I missing.

(SUBSTRING(Copy of DSRHDATI,1,4) +' /' + SUBSTRING( Copy of DSRHDATI,6,2) + '/ ' + SUBSTRING(Copy of DSRHDATI,9,2)) + SUBSTRING(DSRHTIME,1,2) + '.' + SUBSTRING(DSRHTIME,4,2) + '.' + SUBSTRING(DSRHTIME,7,2)

One I get the above to work I plan on convert 18 char to datetimestamp.

Am I on the right track on how to do this?

View 16 Replies View Related

Reporting Services :: How To Convert Int Datatype To Time Format In SSRS

Aug 20, 2015

How do we convert int datatype to "time format" like hh:mm:ss

ex:    123092   ( this 12  + 30 min + 92 sec)
       131137   ( 13 + 11 min + 37 sec)
       111747 ( 11 + 17 min + 47 sec)

View 5 Replies View Related

DB Design :: Convert Integer Date (MMDDYY) And Integer Time (HHMMSS) To DateTime Format?

Jul 20, 2015

Working on a new database where the Date and Time are stored in a Date Time Field.

Then working on an OLDER database file within the same SQL Database contains these 2 items as integers:

transDate = "71615" (July 16, 2015)
transTime = "12345" (01:23:45 AM)

How do we convert both of them into a single SQL DateTime field such as "2015-07-16 01:23:45.000" so that it can be used in a join restricting to a date time in a different SQL File that properly has the DateTime in it?

This works well for converting the transDate Part in the select statement:

   dbo.IntegerToDate(at.transDate) as transDate

   * That returns: "2015-07-16 00:00:00.000"

* The resulting data must work directly in a Microsoft SQL Server Management Studio Query using either using the "on" statement or part of the "where" clause. In other words, NOT as a stored procedure!

Also must be able to be used as a date difference calculation when comparing the 2 files Within say + or - 5 seconds.

View 3 Replies View Related

Display Duration Between Two Datetime Fields In 00:00 Format

Nov 12, 2007

I have a requirement to display the elapsed time between two datetime fields. What i have been able to do is datediff the dates and get the elapsed time in minutes and then i am trying to format it as HH:MM.

For example, an activity started on Nov 1 2007 08:00 and finished Nov 1 23:59, the elapsed time should be displayed as 15:59.

The other example is if the activity spans over a couple of days, it should be say 49:03.


I put the following code in the format of the textbox, but it only seems to work when the length of the minutes is greater than 1.


=IIF(Len(CStr(Fix(ReportItems!textbox11.Value/60)))= 1,

"0" + CStr(Fix(ReportItems!textbox11.Value/60)),

CStr(Fix(ReportItems!textbox11.Value/60)))

+ ":"

+ IIF(Len(CStr(Fix(ReportItems!textbox11.Value Mod 60)))= 1,

"0" + CStr(Fix(ReportItems!textbox11.Value Mod 60)),

CStr(Fix(ReportItems!textbox11.Value Mod 60)))


Have i missed something really simple or what? Any help would be much appreciated.

Alternatively, if you have a better way of doing the whole thing would like to hear from you.

Thanks in advance.

View 1 Replies View Related

Help With Calculating Duration Time

Oct 14, 2005

I have a table called Tickets which contains ticket information for a machine. Each machine can have more than one ticket number opened at the same time. The ticket number contains start date/time and end date/time of the ticket. Thereefore the table looks something like this:

Ticket_No (int)
Machine_No (int)
Description (char)
Start_Time (datetime)
End_Time (datetime)

I want to be able to calculate total duration time(in hours) that EACH MACHINE had a ticket open...but here is the tricky part. The total duration time that a machine had ticket open has to encompas any tickets that may fall in the same time period. For example:
If Machine A has a ticket open at 8:30 and the ticket is closed at 10:00. Meanwhile, Machine A had another separate ticket open at 9:30 which was closed at 10:30. In this case, the total duration time for this machine would be from 8:30 to 10:30 for a total of 2 hrs duration time.

Can anyone help me get started in tackling this problem or provide any examples?

View 4 Replies View Related

Sum Of Duration Between Time Records

Aug 6, 2013

In my example, i have a table as below:

Time|Machine
2013-08-05 10:12:00 |M1
2013-08-05 10:15:00 |M1
2013-08-05 10:20:00 |M1
2013-08-05 10:11:00 |M2
2013-08-05 10:15:00 |M2
2013-08-05 10:16:00 |M2
2013-08-05 10:17:00 |M2
2013-08-06 11:12:00 |M1
2013-08-05 11:42:00 |M1
2013-08-05 12:02:00 |M1

I want to have a report for every machine by time that will show how long each machine worked. The result is something like below:

M1|8 (minutes)
M2|6
M1|50

View 5 Replies View Related

Calculating Duration Time

Dec 13, 2007

Hi guys, I am having difficulty calculating the time duration between receiving process to shipping process.
I have a table that consists of: Order#, Processes, Time_In, Time_Out.
Order# can be 1, 2, 3, 4, 5.
While at the same time Order# 1 can go through more than one process, i.e.: Receiving, VisualTest, MechanicalTest, ..., Shipping.
Every Order# does not necessarily goes through all processes, but surely they will go through receiving process and shipping process.
For each process we will have recorded time when the order# comes in and when it finishes with each process.
I need to calculate the length of time from Time_In from Receiving to Time_Out in Shipping.

I.E.:

Order# | Process | Time_In | Time_out
1 | Receiving | 2007-12-1 10:00:00.000 | 2007-12-1 10:10:00.000
1 | Incoming Q.A. | 2007-12-1 10:40:00.000 | 2007-12-1 11:42:00.000
1 | Visual Check | 2007-12-2 08:10:00.000 | 2007-12-2 11:00:00.000
1 | Shipping | 2007-12-2 11:20:00.000 | 2007-12-2 11:52:00.000
2 | xxxxx | xxxxx | xxxxx
2 | xxxxx | xxxxx | xxxxx
2 | xxxxx | xxxxx | xxxxx

Please help.
Thanks in advance.

View 2 Replies View Related

I Need Help In Calculating Time Duration

Dec 13, 2007

Hi guys, I am having difficulty calculating the time duration between receiving process to shipping process.
I have a table that consists of: Order#, Processes, Time_In, Time_Out.
Order# can be 1, 2, 3, 4, 5.
While at the same time Order# 1 can go through more than one process, i.e.: Receiving, VisualTest, MechanicalTest, ..., Shipping.
Every Order# does not necessarily goes through all processes, but surely they will go through receiving process and shipping process.
For each process we will have recorded time when the order# comes in and when it finishes with each process.
I need to calculate the length of time from Time_In from Receiving to Time_Out in Shipping.

I.E.:

Order# | Process | Time_In | Time_out
1 | Receiving | 2007-12-1 10:00:00.000 | 2007-12-1 10:10:00.000
1 | Incoming Q.A. | 2007-12-1 10:40:00.000 | 2007-12-1 11:42:00.000
1 | Visual Check | 2007-12-2 08:10:00.000 | 2007-12-2 11:00:00.000
1 | Shipping | 2007-12-2 11:20:00.000 | 2007-12-2 11:52:00.000
2 | xxxxx | xxxxx | xxxxx
2 | xxxxx | xxxxx | xxxxx
2 | xxxxx | xxxxx | xxxxx

Please help.
Thanks in advance.

View 6 Replies View Related

Storing Time Duration Data

Nov 15, 2006

i've got an excel spreadsheet generated everyday which stores the duration of talk time as 0:02:09

When i use the Integration Services Package to move the data into a table. I've used datetime column. It comes up as 1899-12-30 00:00:02:09.000

What's best practice to store duration as in a SQL Server table? or should i convert it to seconds.

View 2 Replies View Related

Calculating The Time Duration For Each Event

Jun 6, 2008

Hi all,

Thanks for setting up such a great site and forum.

Here is my problem:

I have a table like the following in SQL Server 2005:


order | taskid | main_person | temp_person | start_assign_date
1 | 3 | John | John | 2008-01-01 10:20:22
2 | 3 | John | Joe | 2008-02-05 15:20:22
3 | 3 | John | John | 2008-02-07 20:25:20
4 | 6 | Joe | Joe | 2008-01-01 10:20:22
5 | 6 | Joe | Mike | 2008-02-01 10:20:22
6 | 10 | Doug | Doug | 2008-01-01 10:20:22
7 | 7 | Russ | Russ | 2008-02-01 11:20:22
8 | 7 | Russ | Mike | 2008-02-08 12:20:22
9 | 7 | Russ | John | 2008-02-10 20:05:12


It was made to record who was in charge of a specific task at a specific time. Each task has its own main responsible person and some substitutes for that person as Temporary Persons (who did the task while main person was away). The Main Person's name is in the temp_person column when he is doing the task by himself.

I'd like to generate a report that shows:
- in a specific time period
- which persons were in charge of a specific task and
- for how long

Something like this:

From 2008-##-## to 2008-##-##
Task 3 - John - 15 days
Task 3 - Joe - 5 days
Task 6 - Joe - 18 days
Task 6 - Mike - 2 days
Task 10 - Doug - 20 days


I have some ideas to do that when there are both start and end dates for every record but I couldn't find a way to use the next assignment start date for each task, as the end date for its previous record (in that task group) to calculate the duration for that record.

I can group the tasks and users and put them in the chronological order but I can't indicate the next start date as the end date for the previous record (in specific task group) to use the date difference functions.

Any hint or comment would be appreciated.

Thanks
Sami

View 4 Replies View Related

Stop Time Duration Problem

Jul 20, 2005

I am working with a proprietary database that records the date, time,location, and speed of a vehicle. It is pulling this information fromGPS unit tied to a vehicle. The table is populated with values thatare pulled from the GPS unit every 30 seconds. I need to find theduration of time for when a vehicle is stopped. I have created acursor that runs though all of the tables, and gathers the data forwhen the vehicle's speed is equal to zero. I have inserted this datainto a temp table, where I am having a problem is identifying theduration of time the vehicle is stopped. I cannot figure out how toquery the table and grab the first row when the speed is zero and thelast row where the speed is zero.The data looks like this…Date TimeVehIDLatLongSpeed12/31/2003 66144 295708535220842.92747-83.63003012/31/2003 66159 295708535220842.92696-83.62935012/31/2003 66179 295708535220842.9271 -83.62902 012/31/2003 66269 295708535220842.92709-83.62903012/31/2003 66359 295708535220842.9271 -83.62901012/31/2003 66449 295708535220842.92709-83.62904012/31/2003 66539 295708535220842.92708-83.62903012/31/2003 66629 295708535220842.92708-83.629 012/31/2003 66719 295708535220842.92708-83.62903012/31/2003 67414 295708535220842.9269 -83.630920Any help would be greatly appreciated…Thanks,Dave

View 5 Replies View Related

Time Duration Calculation Ignoring Overlaps

Apr 16, 2008

Would like to know if it is possible to calculate the duration of a Datetime Start and End Dates ignoring all overlapps?
Eg:
1) StartTime 10:00:00 EndTime 11:00:00 Duration: 01:00:00
2) StartTime 10:30:00 EndTime 11:15:00 Duration: 00:45:00
Total Duration should be 01:15:00 and not 01:45:00

View 16 Replies View Related

How To Convert UTC Time (retrieved From SQL) To Local Time In Reporting Services Based On Time Zone

Aug 7, 2007



Hi all,

I have created a report in SSRS 2005 which is being viewed by users from different Time Zones.

I have a dataset which has a field of type datetime (UTC). Now I would like to display this Date according to the User Time Zone.

For example if the date is August 07, 2007 10:00 AM UTC,

then I would like to display it as August 07, 2007 03:30 PM IST if the user Time Zone is IST.


Similarly for other Time Zones it should display the time accordingly.

Is this possible in SSRS 2005?

Any pointers will be usefull...

Thanks in advance
sudheer racha.

View 5 Replies View Related

Adapter To Convert CSV Format File To SAP IDOC Format

Nov 16, 2006

Hi All,

I am stuck at one place, where I have to convert CSV format file data into SAP IDOC format file. In SSIS we don't have any such SAP adapter (though we have .NET Data Provider for mySAP suite [SSIS SAP Adapter] but this is still not fully supported by Microsoft, plus it doesn't have feature to convert data into IDOC format) that can do this. Can someone here please provide me some pointers on any third party adapters available in market to do this job or if anyone has already developed some custom approach to achieve this task?


Your quick response on this is highly appreciated.

Regards,

Kuldeep Chauhan

View 2 Replies View Related

Transact SQL :: Get Total Request Duration From Multiple Task Duration?

Jun 4, 2015

I have the following SQL query

SELECT
[Req_ID]
,[Service_Name]
,[Req_Started_Date]
,[Task_Name]
,[Task_Status]
,[Performer_Full_Name]

[code]....

Which works fine, but what I need to calculate the total duration of a request based on the duration of the tasks completed in the request based on Req_ID. I would like to use the CASE statement I have to determine the SLA_Mins for each task and add them together to get total request SLA_Mins.

Below is the create table schema and data

GO
/****** Object: Table [dbo].[MidrangeOtherSourceControl] Script Date: 06/03/2015 18:13:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MidrangeOtherSourceControl](
[Req_ID] [float] NULL,
[Service_Name] [nvarchar](255) NULL,

[code]....

View 9 Replies View Related

Data Access :: How To Reduce Record On The Basis Of Time If Minimum 2 Minutes Duration In Server

Sep 8, 2015

I have a table with following data

(Id, date ,time)

11 2015/8/1
12:20:00

11
2015/8/1 12:21:00

11 2015/8/1
18:05:20

12 2015/8/1
11:20:00

12 2015/8/1
11:21:00

12 2015/8/1
18:10:20

I need the table with following record only

(Id, date ,time)

11 2015/8/1
12:20:00

11 2015/8/1
18:05:20

12 2015/8/1
11:20:00

12 2015/8/1
18:10:20

View 7 Replies View Related

Transact SQL :: Converting 24hrs Time To 12 Hours Time Query Format?

Apr 21, 2015

SELECT 
    CONVERT(VARCHAR(10),attnc_chkin_dt,101) as INDATE,
    CONVERT(VARCHAR(10),attnc_chkin_dt,108) as TimePart
FROM pmt_attendance

o/p
indate   04/18/2015
time part :17:45:00

I need to convert this 17:45:00 to 12 hours date format...

View 8 Replies View Related

Printing Local Time Zone In Time Format

Nov 16, 2007

I am in need of a format string or simple vb code that can add the local time zone to the end of a time field.. Something like:
9:36 AM EST
9:36 AM PST

This timezone will just come from the machine that the reporting server is on. I don't see this listed as a standard format, and I have come up empty so far in my research - anyone got a solution for this?

Thanks a bunch!

View 4 Replies View Related

How To Convert Long Date Format To Short Date Format In Store Procedure.

Feb 1, 2008

E.g, i have a store procedure. The start date is long date (4/15/2007 3:00pm). i want to select the start date with a particular date (short date format 4/15/2006). Thanks in advance.

View 1 Replies View Related

Convert Military Time To Standard Time??

Dec 4, 2007

I have two fields which im trying to convert to standard time. IE (09:05 PM) or (12:00 AM).


They are in Military format right now. so i have 15:45 and 21:30 etc etc.

They are both Chars. And its just times and no dates. Can anyone help??

View 7 Replies View Related

Transact SQL :: Cast Or Convert Date In Format YYYY-MM-DD Into New Format Of MM/DD/YYYY?

Nov 27, 2015

I have a table that has a DATE field named. AccountingDate that is in the format YYYY-MM-DD. It's not a VARCHAR field. I simply want to convert this date field into the format MM/DD/YYYY and call it New_Accounting_Date.

I've played with various combinations of CAST & CONVERT but haven't been able to get it to work.

Below is my latest effort which returns the error:

Incorrect syntax near the keyword 'as'

What code would work to return a MM/DD/YYYY value for New_Accounting_Date?

Select GLBATCH.AccountingDate,
convert(GLBATCH.AccountingDate as date),101) AS New_Accounting_Date
from GLBATCH

View 11 Replies View Related

How To Convert Time From Int To Real-time

Oct 28, 2007

Hi all.

I have posted this question in another forum but no one has so far been able to provide a solution to the problem. Since I know Database Journal always has very informative and enlightening posts, I figured I'd post the question here in hopes that some guru can provide an answer.

If you're running SQL 2000 and have any jobs that have been executed, you could perform a query as such:

select last_run_time from msdb.dbo.sysjobsteps

and receive returned values that contain the last time a job was executed "stored in integer datatype" columns. See ->
sp_help sysjobsteps.

In SQL 2005 I believe the concept is the same. I think the intent of Microsoft had it mind for doing this was to store the date separate from the time values which won't work using the datetime datatype and I have read this in documentation in the past.

The challenge is to convert that data into a humanly legible 12 or 24 hour time format like 11:00 AM or 02:45:39.

Does anyone have any suggestions or clues to assist in resolving this problem??? :(

Thanks.

View 6 Replies View Related

Convert UTC Time To Local Time

Dec 29, 2005

Hello,

I am new with the reporting services. I am creating a report and I need to display date/time on the report. But the servers stores those date/time in UTC. How can I convert them to the local time in my report.

 

Thanks for your help.

 

 

View 13 Replies View Related

Format For Convert

Jul 15, 2005

Hello,
 
SELECT name + ‘- ‘ + CONVERT(varchar,amt) as ddlCap from myTable
 
How can I get amt be like “#0.00� format in ddlCap?
 

View 1 Replies View Related

How To Convert Int Value To Binary Format

Dec 10, 2001

Hi, guys,

I need something that can be used in a select statement to convert a int value to binary display format, for example:

5 would be displayed as 0101, etc...

Thanks

View 2 Replies View Related

What The Format Codes Mean In SQL 'CONVERT'

Aug 28, 2007

Aloha !

I am posting this information simply as an FYI. This is in reference to the MS-SQL command "CONVERT"

I spent over 2 hours :rolleyes: screwing around trying to find out different ways of formatting dates from MS-SQL into something that makes sense for what I needed. I googled everything I could think of and found multiple references that said the info is available on MSDN.. but I could not find it. What I did find were thousands of relatively useless references to "format codes" for converting dates, but with no references to what the different format codes would ultimately yield, or what format codes were available to use.

What I ended up doing was writing a small script to generate a list of all of the variations I could find.

Below is the script, and the output that it yielded.
Now, before I get bombarded with "there is a better way" I know there probably is. But this is the way that I needed to do it this particular time. If there are technical errors in my explanation, anyone is welcome to correct them. But after 2 hours of messing with this for what should have been a super simple single .0009 second command, I am just irritated beyond belief that it had to be this complicated to find any useful information on the subject. That is why I am creating this. Hopefully it helps someone else.

The format for the MS SQL CONVERT command is :

CONVERT( length_of_output, date, format_code )

length_of_output : is exactly that . the number of characters that you want returned as your result. If you use a length of 6 you will only see the first 6 characters that are returned. I found the longest valid length to be 28 characters, but I went as high as 128 just for giggles and to see if it revealed any secrets.

date : is a valid date, I used directly the getdate() function

format_code : well.. that's the tricky part. See below.

What I did was ran a script that originally went from 1 to 20,000. It crashed at 15. Apparently the format codes are not totally sequential. So I put in an on error resume next.

What I found is that :
1) the codes are not uninterrupted sequential numbers.
2) the code output repeats every 255
3) negative numbers can be used, but its pointless.
4) useful valid codes are in the ranges of : 0-14, 20-25, 100-114, 120, 121, 126, 130 and 131
5) 0-25 typically represent "short dates" with the year being only 2 digits, but there are exceptions
6) 100 and above always returned a 4 digit year. the exception was 130 and 131, I don't know what it was trying to do.

Here is the script i ran

<%
on error resume next

for iintCounter = 0 to 256
SQL = "SELECT CONVERT(CHAR(128), getdate(), " & iintCounter & " ) as TheDate"
Set rsTheDateFormat = TheDatabase.Execute(SQL)

response.write SQL & " = " & rsTheDateFormat("TheDate") & "<br>"

set rsTheDateFormat = nothing
next
%>



and here is the output
SELECT CONVERT(CHAR(128), getdate(), 0 ) as TheDate = Aug 28 2007 6:46AM
SELECT CONVERT(CHAR(128), getdate(), 1 ) as TheDate = 08/28/07
SELECT CONVERT(CHAR(128), getdate(), 2 ) as TheDate = 07.08.28
SELECT CONVERT(CHAR(128), getdate(), 3 ) as TheDate = 28/08/07
SELECT CONVERT(CHAR(128), getdate(), 4 ) as TheDate = 28.08.07
SELECT CONVERT(CHAR(128), getdate(), 5 ) as TheDate = 28-08-07
SELECT CONVERT(CHAR(128), getdate(), 6 ) as TheDate = 28 Aug 07
SELECT CONVERT(CHAR(128), getdate(), 7 ) as TheDate = Aug 28, 07
SELECT CONVERT(CHAR(128), getdate(), 8 ) as TheDate = 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 9 ) as TheDate = Aug 28 2007 6:46:45:507AM
SELECT CONVERT(CHAR(128), getdate(), 10 ) as TheDate = 08-28-07
SELECT CONVERT(CHAR(128), getdate(), 11 ) as TheDate = 07/08/28
SELECT CONVERT(CHAR(128), getdate(), 12 ) as TheDate = 070828
SELECT CONVERT(CHAR(128), getdate(), 13 ) as TheDate = 28 Aug 2007 06:46:45:507
SELECT CONVERT(CHAR(128), getdate(), 14 ) as TheDate = 06:46:45:507
SELECT CONVERT(CHAR(128), getdate(), 20 ) as TheDate = 2007-08-28 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 21 ) as TheDate = 2007-08-28 06:46:45.540
SELECT CONVERT(CHAR(128), getdate(), 22 ) as TheDate = 08/28/07 6:46:45 AM
SELECT CONVERT(CHAR(128), getdate(), 23 ) as TheDate = 2007-08-28
SELECT CONVERT(CHAR(128), getdate(), 24 ) as TheDate = 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 25 ) as TheDate = 2007-08-28 06:46:45.540
SELECT CONVERT(CHAR(128), getdate(), 100 ) as TheDate = Aug 28 2007 6:46AM
SELECT CONVERT(CHAR(128), getdate(), 101 ) as TheDate = 08/28/2007
SELECT CONVERT(CHAR(128), getdate(), 102 ) as TheDate = 2007.08.28
SELECT CONVERT(CHAR(128), getdate(), 103 ) as TheDate = 28/08/2007
SELECT CONVERT(CHAR(128), getdate(), 104 ) as TheDate = 28.08.2007
SELECT CONVERT(CHAR(128), getdate(), 105 ) as TheDate = 28-08-2007
SELECT CONVERT(CHAR(128), getdate(), 106 ) as TheDate = 28 Aug 2007
SELECT CONVERT(CHAR(128), getdate(), 107 ) as TheDate = Aug 28, 2007
SELECT CONVERT(CHAR(128), getdate(), 108 ) as TheDate = 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 109 ) as TheDate = Aug 28 2007 6:46:45:913AM
SELECT CONVERT(CHAR(128), getdate(), 110 ) as TheDate = 08-28-2007
SELECT CONVERT(CHAR(128), getdate(), 111 ) as TheDate = 2007/08/28
SELECT CONVERT(CHAR(128), getdate(), 112 ) as TheDate = 20070828
SELECT CONVERT(CHAR(128), getdate(), 113 ) as TheDate = 28 Aug 2007 06:46:45:930
SELECT CONVERT(CHAR(128), getdate(), 114 ) as TheDate = 06:46:45:930
SELECT CONVERT(CHAR(128), getdate(), 120 ) as TheDate = 2007-08-28 06:46:45
SELECT CONVERT(CHAR(128), getdate(), 121 ) as TheDate = 2007-08-28 06:46:45.943
SELECT CONVERT(CHAR(128), getdate(), 126 ) as TheDate = 2007-08-28T06:46:45.990
SELECT CONVERT(CHAR(128), getdate(), 130 ) as TheDate = 15 ????? 1428 6:46:46:040AM
SELECT CONVERT(CHAR(128), getdate(), 131 ) as TheDate = 15/08/1428 6:46:46:040AM
SELECT CONVERT(CHAR(128), getdate(), 256 ) as TheDate = Aug 28 2007 6:46AM

View 11 Replies View Related

Convert Date Format From 23 Aug 07 To Mm-dd-yy

Sep 13, 2007

I have this stored procedure, and im trying to figured out how i can convert the date field into something i can actually sort in the right order in reporting services. Such as mm-dd-yy , whats the SQL code for doing that?

View 6 Replies View Related

Transact SQL :: How To Convert Hmm Int To Hh:mm:ss Tt Format

Jun 30, 2015

I have these values 

100
900
1300

in int format , now i want to convert them to hh:mm:ss tt format in sql. How can this be done ? I have used this query

declare @nvsDateTime int;set @nvsDateTime = 100;
select convert(datetime, convert(varchar(10),CURRENT_TIMESTAMP,120)  + ' ' + stuff(ltrim(@nvsDateTime),3,0,':') ) AS Answer

But it is only converting 100 and 1300 but not 900 and giving me this error :

Msg 242, Level 16, State 3, Line 2

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved