Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date Format

I have date column that contains dates like this 3/17/17 rather than 3/17/2017 and in the database the date is displayed like this 0017-03-17 00:00:00. In my tMap I have this:

row1.Actual_Sale_Date.equals("")?null: TalendDate.parseDate("MM/dd/yyyy",row1.Actual_Sale_Date) 



Even though I have the format defined as "MM/dd/yyyy" the database shows timestamp without time zone and the dates are 
2017-03-17 00:00:00. I want to display 03/17/2017 in database.
Please kindly offer assistance.
Thanks in Advance,
John Doe

Labels (2)
3 Replies
cterenzi
Specialist
Specialist

Dates are not Strings.  The printed format of a date is not indicative of how it is stored.  If you want a date to print a certain way, you have to format it.  If your database offers multiple date types, maybe a different one would better suit your purposes?  MySQL, for example, has DATE, DATETIME and TIMESTAMP, among others. ( https://www.tutorialspoint.com/mysql/mysql-data-types.htm)
Anonymous
Not applicable
Author

Thanks I am using postgreSQL and just interested in plain Date format.
Anonymous
Not applicable
Author

[font=consolas, monaco, bitstream vera sans mono, courier new, courier, monospace] first argument is source pattern and as your are getting in yy format in year, u can change as below and try.[/font]
[size=2][font=consolas, monaco, "bitstream vera sans mono", "courier new", courier, monospace]row1.Actual_Sale_Date.equals("")?null: TalendDate.parseDate ("MM/dd/yy",row1.Actual_Sale_Date) .[/font][/size]