Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Convert a string (in date format) to datetime using Javascript

In BIRT, i have a column containing a datetime stored as a string. I need to convert these string to datetime format and put the result in another column using Javascript. The string is the form of: for example: Fri 21 Feb 2014, 09:40 AM.

Hence this when converted to a datetime format and exported to excel, the column should be treat as a date. Can any one of you help me to do it?


like image 938
Ram Avatar asked Dec 25 '22 11:12


1 Answers

Other answers do not take into consideration this question is in a BIRT context.

  • Create a computed column in your dataset, with "Date time" as datatype
  • Enter as expression:

new Date(row["myDateStringField"]);

Where "myDateStringField" is your DateTime column in a String format. Then use this computed column in your report instead of the String column.

That's it!

like image 93
Dominique Avatar answered Jan 05 '23 15:01