update table
set date_field = dateadd(mi,-1,dateadd(dd,1
where date_field = '1/4/99'
when hh and mi are not specified it assumes (12:00 AM)midnight time.
Main Topics
Browse All Topicshi,
i have date format in mm/dd/yy hh:mm:ss in my database.
for example a date field is presently looks like 01/04/99 12:00:00. but i want to convert the same datefield to 01/04/99 11:59:00. could anybody help in writing query to update the that particular date field to my required format. i am using
sybase 10.2....
01/04/99 12:00:00 To 01/04/99 11:59:00
thanX
hmk
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Of course the dateadd(mi,-1) does not work, since the
date must stay the same...
what you can do is (considering the jan 4 is an example)
update table_name
set date_field = convert(datetime,convert(c
go
If you really only need to update the jan 4th you can also use
the answer of ajith29. (Or add a where clause to my update statement saying 'where datefield = '19990104' )
Arjan
For the same date changes you can use the following query. My previous update statement was wrong because it would minus one day from the date. But you can use this Update syntax.
Update Table_Name
Set Date_Field = DateAdd(day, 1, DateAdd(MI, -1, Date_Field))
Where Date_Field = 'Jan 4 99'
/* Any Date You Wanna Change */
This will work!
TahirKhalil
Business Accounts
Answer for Membership
by: ajith_29Posted on 1999-11-03 at 05:32:05ID: 2179883
lets name the field to upadate has time_upadate
and the table name is upadate_table
>update update_table
>set time_update = '01/04/1999 11:59:00'
>where time_update = '01/04/199 12:00:00'
>go
This is solve u problem