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

exporting individual date and time columns #9

Open
rsubr opened this issue Aug 26, 2018 · 0 comments
Open

exporting individual date and time columns #9

rsubr opened this issue Aug 26, 2018 · 0 comments

Comments

@rsubr
Copy link

rsubr commented Aug 26, 2018

I recently had to export a table from MS SQL Server that had individual date and time columns. sqltocsv exports both columns as time stamps (date + time). The resulting date column in CSV has 2018-05-02 00:00:00 +0000 UTC and time column is 0001-01-01 13:24:02 +0000 UTC.

The attached sqltocsv.go file has a crude hack that formats the results as time if the date is null (0001-01-01) and as date if otherwise.

There are definitely better ways to do this, but it worked for me. Hope this is useful to someone.

sqltocsv.go.txt

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

1 participant