Excel date_format tostring string.format type function

Posted: March 8th, 2011
By:
admin

So it took me about 10 minutes to figure out that Excel has a date_format, date, date.toString() like function. It’s called text(). To get a date format into something which will import nicely into a postgres or mysql database, simply do somthing like this:
text(A1, "yyyy-mm-dd")

And since all the other languages seem to have a more clear “date format” function, here are the corresponding methods:

  • .Net/C# – String.Format() or DateTime.ToString()
  • php – date()
  • mysql – date_format()
  • postgres – to_char()
  • java – String.Format combined with a java.util.Calendar
#000000
#1d3147
#415973
#9dacb9
#4c3724
#897661
#d1c8c0
#ffffff