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 "vbcompat.bi"
#include "windows.bi"

Sub ClearClipboard(hwnd As HWND = NULL)
    OpenClipboard(hWnd)
    EmptyClipboard()
    CloseClipboard()
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)        
    OpenClipboard(hWnd)
    EmptyClipboard()
    Var lpMem = GlobalLock(hGlobalClip)
    CopyMemory(lpMem, StrPtr(Text), Len(text))
    GlobalUnlock(lpMem)
    SetClipboardData(CPFormat, hGlobalClip)
    CloseClipboard()
End Sub        

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

ClearClipboard()
CurrentDateTime = Format(a, "yyyy-mm-dd hh:mm")
WriteClipboard(CurrentDateTime)
link|improve this question

60% accept rate
1  
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
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.