ESP8266 (WeMos D1 Mini) logging to micro SD with NTP timestamp

I recently purchased a IOT development board with wifi (WeMos D1 Mini, based on ESP8266) and micro SD module. I would like to make a temperature logger that:

  1. connects to local wifi network
  2. gets the time from network (NTP)
  3. reads the temperature value from Dallas onewire sensor (DS18B20)
  4. saves the value along with timestamp to micro SD card
  5. uploads the value to M2X server
  6. disconnects wifi and goes to Deep Sleep mode to save battery

The main problem so far is HOW TO GET NETWORK TIME AND SAVE IT TO SD CARD?
Can someone help me?

You don't even need an SD card. The ESP has plenty of flash storage (up to 3MB).

Take a look at this example I wrote.

You can find more information on HTTP and how to send information to a server in the other chapters.