Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 4 of 4 total |
Combine date and time |
Sat, Jan 6 2018 11:11 AM | Permanent Link |
Hershcu Sorin | Hi
I want to combine a Date and a Time field to one. Something like: "select MyDate + MyTime as MyDateTime from..." What is the right command? Thanks Sorin |
Sat, Jan 6 2018 6:17 PM | Permanent Link |
Fernando Dias Team Elevate | Sorin,
Try this: SELECT MyDate + (MyTime - TIME '0') FROM ... The expression (MyTime - TIME '0') is going to convert the original TIME value into an INTERVAL, that is after added to the DATE, resulting in a TIMESTAMP. -- Fernando Dias [Team Elevate] |
Sun, Jan 7 2018 3:56 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Hershcu
I like Fernando's approach - its sneaky. There is always the traditional CAST approach CAST(CAST(MyDate AS VARCHAR(10))+' '+CAST(MyTime AS VARCHAR(10)) AS TIMESTAMP) Roy Lambert |
Mon, Jan 8 2018 4:04 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Fernando,
<< Try this: >> Roy is right - that *is* sneaky... Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, May 4, 2024 at 09:18 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |