Camnoc
asked on
Getdate format
Hi
Using enterprise manager I insert Getdate() into default column which returns todats date and time every time I inser a record. Is there some way I can change the format from dd,mm, yyyy,hh,mm to dd.mm,yyyy.
I have tried SELECT *, CONVERT(VARCHAR, GETDATE(), 3) AS Dateentered
FROM EmployeeTime2 but this changes the dates in all rows.
Camnoc
Using enterprise manager I insert Getdate() into default column which returns todats date and time every time I inser a record. Is there some way I can change the format from dd,mm, yyyy,hh,mm to dd.mm,yyyy.
I have tried SELECT *, CONVERT(VARCHAR, GETDATE(), 3) AS Dateentered
FROM EmployeeTime2 but this changes the dates in all rows.
Camnoc
If you are looking to strip the datetime of the time, I would suggest this.
convert(CONVERT(VARCHAR(10 ), GETDATE(), 101),101)
BUT, as matthewspatrick has pointed out, don't confuse the storage with the display. It will still store it in a datetime field and will be returned (with the time) based upon the regional settings of the server.
convert(CONVERT(VARCHAR(10
BUT, as matthewspatrick has pointed out, don't confuse the storage with the display. It will still store it in a datetime field and will be returned (with the time) based upon the regional settings of the server.
ASKER
OK so my knowledge of sql is really bad, I am probably relying on Enterprise Manage too much, however heres my table.
SELECT empid, Time_in, time_out, CONVERT(VARCHAR(10), GETDATE(), 101) AS Date_only, Date_entered FROM dbo.EmployeeTime2.
Date_entered shows the date as records are inserted but in format dd,mm,yyyy, hh,mm. Date_only will show date in the correct format but in all rows. I just want to insert the getdate() in dd,mm, yyyy every time a record is inserted??
SELECT empid, Time_in, time_out, CONVERT(VARCHAR(10), GETDATE(), 101) AS Date_only, Date_entered FROM dbo.EmployeeTime2.
Date_entered shows the date as records are inserted but in format dd,mm,yyyy, hh,mm. Date_only will show date in the correct format but in all rows. I just want to insert the getdate() in dd,mm, yyyy every time a record is inserted??
Camnoc said:
>>I just want to insert the getdate() in dd,mm, yyyy every time a record is inserted??
If the column you are inserting into is defined as datetime, then the format *does not matter*. Just let
it go :)
>>I just want to insert the getdate() in dd,mm, yyyy every time a record is inserted??
If the column you are inserting into is defined as datetime, then the format *does not matter*. Just let
it go :)
Or smalldatetime, for that matter...
smalldatetime really only drops the seconds and milliseconds. You still have the hours and minutes portion of the time.
ASKER
Hi BRANDON
Thank you so much, I think am going to give up on using SQL for my timesheet project Excel is a far simpler option. There may be a dreamweaver extension available I hav'nt looked.
Sorry I gave all the points to Matthewspatrick ,I clicked the wrong Button, I should have split the points.
I will be careful the next time.
Thanks for all your help.
Camnoc
Thank you so much, I think am going to give up on using SQL for my timesheet project Excel is a far simpler option. There may be a dreamweaver extension available I hav'nt looked.
Sorry I gave all the points to Matthewspatrick ,I clicked the wrong Button, I should have split the points.
I will be careful the next time.
Thanks for all your help.
Camnoc
Camnoc,
Use the 'request attention' link to ask a Mod to reopen the question.
Regards,
Patrick
Use the 'request attention' link to ask a Mod to reopen the question.
Regards,
Patrick
ASKER
Where is the 'request attention' button . I really shouldnt get up on Mondays:)
It's in the main body of your question at the top of the page.
ASKER
Hi Brandon
The question is reopened.
The question is reopened.
OK?
You asked "Where is the 'request attention' button" and I responded "It's in the main body of your question at the top of the page.".
Did you need help with something else because all you said was "I should have split the points".
You asked "Where is the 'request attention' button" and I responded "It's in the main body of your question at the top of the page.".
Did you need help with something else because all you said was "I should have split the points".
ASKER
Hi Brandon
I have been trying to get my time calculations to work with little success. I will submit a new question with code attached tomorrow if you can you might have a look.
Paul
I have been trying to get my time calculations to work with little success. I will submit a new question with code attached tomorrow if you can you might have a look.
Paul
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Your right
Thanks very much.
Thanks very much.
1) Do not confuse the way a date value is stored with how it is displayed.
2) You seem not to want the formatting applied to all rows. What is it that you are after?
Patrick