Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I sometimes need to type the current date + time in MySQL format, ie. YYYY-MM-DD HH:MM.

Before I write one myself, does someone know of a Windows applet that does this, so I could just double-click on it, and paste the clipboard elsewhere?

Thank you.

Edit: Turns out it was pretty easy to do in Freebasic, although it's a console applet instead of a GUI applet:

#include ""
#include ""

Sub ClearClipboard(hwnd As HWND = NULL)
End Sub

Sub WriteClipboard(Text As String, CPFormat As Integer = CF_TEXT, hWnd As HWND = NULL)        
    Var hGlobalClip = GlobalAlloc(GMEM_MOVEABLE Or GMEM_SHARE, Len(Text)+1)        
    Var lpMem = GlobalLock(hGlobalClip)
    CopyMemory(lpMem, StrPtr(Text), Len(text))
    SetClipboardData(CPFormat, hGlobalClip)
End Sub        

Dim a As Double = Now()
Dim CurrentDateTime as String

CurrentDateTime = Format(a, "yyyy-mm-dd hh:mm")
share|improve this question
Answers belong in the answer box. – Ignacio Vazquez-Abrams Jun 1 '11 at 10:24
I always thought applet refereed to the java specification? Maybe just me... – slotishtype Jun 1 '11 at 11:14

I quickly made an HTA utility to do that named GetMySQLDateTime using VBScript. Feel free to use/modify/redistribute it for any purpose. As it's a HTA, you may directly modify the code using any text editor.


Usage: Just run it and the string will be on your clipboard. Click "Refresh" button to update it.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .