Question: [snippet of The date format received](https://i.stack.imgur.com/23uhm.png) I want to display the date in an HTML table but unable to convert the iso8601 type date format to the date object.

```
$(document).ready(function(){

    var startDate;
    var formattedDate;
    var day;

    $(function(){
        $.ajax({
            url: "http://localhost:8080/employee/101",
            method: "Get",
            success: function(data,status){
                startDate = new Date(data.joinDate);
                day = startDate.dayOfWeek;
                console.log(startDate);
            }   
        });
    });

```

> 
> I get error : invalid date at "console.log(startDate);"
> 
> 
> 

I also need to increment the date but stuck at converting the iso8601 format to a normal date object.

Answer: 
HOLY COW ! After a few more days of headaches I FINALLY found an approach that works... here is what I did to get the program to work without requiring an external image file:

step 1: encode the image file (note that it must be a GIF. you can convert it using paint):

```
import base64
with open("MyPicture.gif", "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read())
print(encoded_string)#print string to copy it (see step 2)

```

step 2: the next step is to copy and paste the string into a separate myimages.py file and 
store it as variable. for example:

```
imageString = b'R0lGODlhyADIAPcAAAA .....blah blah really long string.......'

```

step 3: then import the myimages.py into main program and call the variable

```
from myimages import *
pic=imageString#GIF decoded to string. imageString from myimages.py
render = PhotoImage(data=pic)
myLabel.config(image=render)

```

step 4: in the spec file: include the myimages.py as data

```
# -*- mode: python -*-

block_cipher = None

#instructions: pyinstaller --onefile --noconsole myProgram.spec

file_name = 'myProgram'
add_files=[('myimages.py','module')]

a = Analysis([file_name+'.py'],
             pathex=['C:\\Program Files (x86)\\Python36-32\\Scripts'],
             binaries=[],
             datas=add_files,
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=exclude_list,
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name=file_name,
          debug=False,
          strip=False,
          upx=True,
          runtime_tmpdir=None,
          console=False )

```

step 5: finally you can compile to EXE:

```
pyinstaller --onefile --noconsole myProgram.spec

```

*SIGH* If anyone has a better solution, please post it here. until then I'm glad something works...
I ran into the same issue when I was wanting to include a .ico file to use as the icon for my tkinter app. Here's how I got it to work:

1. When building the .exe file with PyInstaller, I specified the --add-data option with the full path to my .ico.
2. When the app starts up, it has to unpack everything from the .exe in a temp directory, so I get the path to that temp directory and use it to specify the temp location of my .ico file.

Before the mainloop is kicked off, and using 'tempfile' to get the temp file directory and 'glob' to check for a file pattern match:

```
tempdir = tempfile.gettempdir()
icon_path = tempdir + '\\' + 'next_subdirectory_pattern' + '\\' + '*.ico'
icon_matches = glob.glob(icon_path)
if len(icon_matches) > 0:
    logo = icon_matches[0]
else:
    logo = ''
tk.Tk.iconbitmap(self, default=logo)

```

Probably not the most eloquent way to do it, but it works.