Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] #525

Closed
yidasanqian opened this issue Oct 18, 2017 · 3 comments
Closed

Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] #525

yidasanqian opened this issue Oct 18, 2017 · 3 comments

Comments

@yidasanqian
Copy link
Contributor

yidasanqian commented Oct 18, 2017

DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
String currentDate = dateFormat.format(new Date());
expressionList.getExpressions()
                        .add(new TimestampValue(currentDate ));

Exception:

Caused by: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
	at java.sql.Timestamp.valueOf(Timestamp.java:237)
	at net.sf.jsqlparser.expression.TimestampValue.<init>(TimestampValue.java:34)
@wumpz
Copy link
Member

wumpz commented Oct 18, 2017

TimestampValue expects the value in simple quotation.

new TimestampValue("'" + currentDate + "'");

Maybe you could provide a PR to correct this and process both (with / without) possibilities.

@yidasanqian
Copy link
Contributor Author

yidasanqian commented Oct 18, 2017

@wumpz
Source Code Version:1.2-SNAPSHOT

There is no such class SimpleNode
qq 20171019140647

@wumpz
Copy link
Member

wumpz commented Oct 20, 2017

SimpleNode is one of the classes generated by jjtree. You need to build it using maven. Then the missing classes will be under genereated-sources.

yidasanqian pushed a commit to yidasanqian/JSqlParser that referenced this issue Oct 23, 2017
@wumpz wumpz closed this as completed in 1a1a1aa Oct 24, 2017
yidasanqian added a commit to yidasanqian/JSqlParser that referenced this issue Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants