how can i sort the date time in a sql script. At first i am using the datetimeFormatter to get the date-time in a specific format. Later i am writing into a SQL table using a script. Below is my grovvy code.
def date = Finish / 1000; ////here Finish is in java.lang.Long
LocalDateTime dateTime = LocalDateTime.ofEpochSecond(date, 0, ZoneOffset.UTC);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm:ss dd-MM-yyyy", Locale.ENGLISH);
String formattedDate = dateTime.format(formatter);
main.setdoneTime(formattedDate);
In a sql table i have a column called Timedone having varchar(255) format. I am trying to order the Timedone in a ascending order, through a script,
select * from [devnew].[dbo].[Table1] WHERE Total!= Right + Left order by Timedone
only the time is getting sorted but not the date, month or year. how can i make both sorted.