+ Reply to Thread
Results 1 to 6 of 6

Issue with dates when saving as .csv

  1. #1
    Registered User
    Join Date
    08-09-2017
    Location
    Brisbane
    MS-Off Ver
    Office Home & Business 2016
    Posts
    21

    Issue with dates when saving as .csv

    Hi,

    I have a Power Query table in an .xlsm workbook with a field [Period] that is type date and has the first day of each month. I am in Sydney, so format is dd/mm/yyyy.

    Excel_Period.JPG

    I want to save the sheet as a .csv file, however the .csv file has "day" & "month" swapped around. So 1/07/2018 has been converted to 7/01/2018. The below screenshot is from when I have tried to use the csv as a source in a new Query but it also happens when I try to open the .csv file in Notepad.

    Excel_Period2.JPG
    Notepad_Period.JPG

    I have never seen this before.

    Any ideas?

  2. #2
    Registered User
    Join Date
    08-09-2017
    Location
    Brisbane
    MS-Off Ver
    Office Home & Business 2016
    Posts
    21

    Re: Issue with dates when saving as .csv

    I should have added that I am creating the .csv file via VBA with this code:
    Please Login or Register  to view this content.
    It seems that if I create the .csv by going to Save As & changing file type to .csv, the issue does not occur.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Issue with dates when saving as .csv

    Maybe consider using =TEXT() to change the date from a number, into text
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Issue with dates when saving as .csv

    Looks like a Regional Settings problem. If I remember correctly, csv has to be forced to use non-American settings. Try adding Local:=True to the end of your save statement:
    Please Login or Register  to view this content.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  5. #5
    Registered User
    Join Date
    08-09-2017
    Location
    Brisbane
    MS-Off Ver
    Office Home & Business 2016
    Posts
    21

    Re: Issue with dates when saving as .csv

    Thanks very much, that works!

  6. #6
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Issue with dates when saving as .csv

    You're welcome and thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Saving/Opening Workbook issue
    By orangejuicejames in forum Excel General
    Replies: 3
    Last Post: 12-11-2017, 01:00 AM
  2. [SOLVED] Macro /saving issue
    By 1967chris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2015, 02:16 AM
  3. VBA Saving issue with quotes
    By steven_b46 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2014, 12:43 PM
  4. [SOLVED] Saving file issue
    By punter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2013, 03:32 PM
  5. Saving Issue
    By cmm5350 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2012, 10:16 AM
  6. saving issue
    By sannndrad in forum Excel General
    Replies: 0
    Last Post: 11-24-2011, 05:06 AM
  7. chart template saving issue
    By spinkung in forum Excel General
    Replies: 9
    Last Post: 01-12-2010, 07:44 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1