Programming, technology, and CRM – from a Belgian programmer exiled to Missouri
  • rss
  • Home
  • Soft Gallery
    • autosvnbackup.sh
    • VBScript Snippets
  • Contact Me
  • Welcome

Formatting localized date in the browser

Nicolas Galler | August 31, 2007

Well the closest I could get to this without making it a major ordeal was to use a VBScript section… I need something like “toLocaleShortDateString” in the Javascript but that doesn’t seem to exist (presumably because the short date format may not be defined on all OS’s). Obviously this will only work on IE.

<script language="vbscript">
Function formatShortDate(d)
formatShortDate = FormatDateTime(d, vbShortDate)
End Function
</script>

<script language="JavaScript">
alert(formatShortDate("2007-08-01 21:22:32"));
</script>

Oh yeah, FormatDateTime() won’t eat a Javascript Date object, and neither will CDate(). It has to be a string.

Categories
Programming
Comments rss
Comments rss
Trackback
Trackback

« MIME -> MAPI Conversion Raising Events in a SQL Server trigger »

Leave a Reply

Click here to cancel reply.

Categories

  • Experiments (4)
  • Interesting (1)
  • MSCRM (1)
  • Programming (60)
  • Rant (3)
  • Saleslogix (34)
  • Tricks (8)
  • Uncategorized (30)

Post History

  • 2010
    • January (3)
    • March (3)
    • April (2)
    • August (2)
  • 2009
    • March (2)
    • April (1)
    • May (3)
    • June (3)
    • July (1)
    • September (3)
    • October (2)
    • December (5)
  • 2008
    • January (9)
    • February (4)
    • March (9)
    • April (1)
    • May (5)
    • June (8)
    • July (1)
    • August (2)
    • September (1)
    • November (1)
    • December (3)
  • 2007
    • January (3)
    • February (7)
    • March (1)
    • April (3)
    • May (6)
    • June (2)
    • July (1)
    • August (2)
    • September (5)
    • October (3)
    • November (5)
    • December (4)
  • 2006
    • January (2)
    • September (1)
    • November (3)
    • December (4)
  • 2005
    • April (1)

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox