Discordchatexporter: Unix timestamp support

Created on 20 Oct 2019  路  6Comments  路  Source: Tyrrrz/DiscordChatExporter

It would be amazing to have the option to use unix timestamps. This would make it much easier to migrate channel data to slack via csv import.

enhancement help wanted

Most helpful comment

I _really_ wanted to get the data into slack but am not good with C#. So I wrote a python script to do the unix timestamp and also convert the csv data that DiscordChatExporter outputs to Slack's csv import format. For anyone who is interested: here you go 鉁岋笍

All 6 comments

I would also enjoy this just for posterity's sake

I _really_ wanted to get the data into slack but am not good with C#. So I wrote a python script to do the unix timestamp and also convert the csv data that DiscordChatExporter outputs to Slack's csv import format. For anyone who is interested: here you go 鉁岋笍

Would #103 help solve your issue? Assuming the dates are stored in ISO format.

Also, if UTC date format is good enough for you, you can set custom date format in settings to u or U (according to this).

Closing #103 wouldn't resolve this particular issue. JSON would definitely be easier to process but I didn't have any problems reading the CSV file format in particular. The challenge was simply to convert the .NET timestamp to a unix timestamp (a single integer), because it's what the Slack CSV import requires.

In Python this was luckily quite easy to do. when exporting the CSV using DiscordChatExporter I left the time format at the default

date = row[1] # the original date entry from the CSV file from DiscordChatExporter
convDate = datetime.datetime.strptime(date, "%d-%b-%y %I:%M %p") # 06-Dec-18 08:51 AM
unixDate = int(convDate.replace(tzinfo=datetime.timezone.utc).timestamp())

This could be implemented by using a custom format provider that would accept and handle additional date formats, such as unix for unix time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tyzoid picture tyzoid  路  3Comments

Sakani17 picture Sakani17  路  3Comments

Jakhaxz picture Jakhaxz  路  3Comments

NNNIIndia picture NNNIIndia  路  4Comments

penguinsoba picture penguinsoba  路  3Comments