Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created August 2, 2012 20:33
Show Gist options
  • Save mhulse/3240388 to your computer and use it in GitHub Desktop.
Save mhulse/3240388 to your computer and use it in GitHub Desktop.
Caché DTI ContentPublisher: Tested in 7.6, 7.7.2: Experimental date validation...
<script language="cache" runat="server">
//--------------------------------------------------------------------------
//
// Snakes. Why did it have to be snakes?
//
//--------------------------------------------------------------------------
/**
* Validate date.
*
* @param date/time string.
* @param dformat.
* @return boolean
* @see rgne.ws/Rh67IW
*/
#define sallah(%s) $select(+$zdatetimeh(%s,,,,,,,,,0):1, +$zdatetimeh(%s,2,,,,,,,,0):1, +$zdatetimeh(%s,3,,,,,,,,0):1, +$zdatetimeh(%s,4,,,,,,,,0):1, +$zdatetimeh(%s,5,,,,,,,,0):1, +$zdatetimeh(%s,6,,,,,,,,0):1, +$zdatetimeh(%s,7,,,,,,,,0):1, +$zdatetimeh(%s,8,,,,,,,,0):1, +$zdatetimeh(%s,9,,,,,,,,0):1, 1:0)
//--------------------------------------------------------------------------
//
// Take this. Wave it at anything that slithers.
//
//--------------------------------------------------------------------------
new indy
; "GOOD" DATES:
set indy = $listbuild("01/01/97", "03/27/2002", "01 Jul 97", "27 Mar 2002", "1997-07-01", "2002-03-27", "01/07/97", "27/03/2002", "Jul 1, 1997", "Mar 27, 2002", "Jul 1 1997", "Mar 27 2002", "Jul 01 1997", "Mar 27 2002", 19930701, 20020327, "July 1, 1997", "March 27, 2002")
; "BAD" DATES:
set indy = indy _ $listbuild("12/31/1840", "03/27333/2002", "01 Juld 97", "44 Mar 2002", "1830-07-01", "2002-13-27", "01/07/222222", "31/////03/2002", "Jul 1,,,,, 1997", "Mar2 27, 2002", "Jul11997", "Mar 272002", "jully 011997", "Mar 27 1804", 199307011111111, 0327, "July1,1997,,,", "Marcdh 272, 122002")
/*
for i=1:1:$listlength(indy) {
if ($$$sallah($list(indy, i))) {
w "<p>Indiana Jones: Fortune and glory, kid. Fortune and glory.</p>"
} else {
w "<p>Sallah: [catches date and points to dead monkey] Bad dates.</p>" // youtu.be/0qIMTA4_YdU
}
}
*/
</script>
<ol>
<csp:loop counter="i" from="1" to="#($listlength(indy))#">
#[ new date set date = $list(indy, i) ]#
<csp:if condition='$$$sallah(date)'>
<li><b>Indiana Jones:</b> <a href="http://youtu.be/FqR_p_KFNsw">Fortune and glory, kid. Fortune and glory</a>. <i>(#(date)#)</i></li>
<csp:else>
<li><b>Sallah:</b> [catches date and points to dead monkey] <a href="http://youtu.be/0qIMTA4_YdU">Bad dates</a>. <i>(#(date)#)</i></li>
</csp:if>
#[ kill date ]#
</csp:loop>
</ol>
<script language="cache" runat="server">
//--------------------------------------------------------------------------
//
// Mola Ram! Prepare to meet Kali... IN HELL!
//
//--------------------------------------------------------------------------
#undef sallah
kill indy
</script>
Indiana Jones: Fortune and glory, kid. Fortune and glory. (01/01/97)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (03/27/2002)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (01 Jul 97)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (27 Mar 2002)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (1997-07-01)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (2002-03-27)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (01/07/97)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (27/03/2002)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (Jul 1, 1997)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (Mar 27, 2002)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (Jul 1 1997)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (Mar 27 2002)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (Jul 01 1997)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (Mar 27 2002)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (19930701)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (20020327)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (July 1, 1997)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (March 27, 2002)
Sallah: [catches date and points to dead monkey] Bad dates. (12/31/1840)
Sallah: [catches date and points to dead monkey] Bad dates. (03/27333/2002)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (01 Juld 97)
Sallah: [catches date and points to dead monkey] Bad dates. (44 Mar 2002)
Sallah: [catches date and points to dead monkey] Bad dates. (1830-07-01)
Sallah: [catches date and points to dead monkey] Bad dates. (2002-13-27)
Sallah: [catches date and points to dead monkey] Bad dates. (01/07/222222)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (31/////03/2002)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (Jul 1,,,,, 1997)
Indiana Jones: Fortune and glory, kid. Fortune and glory. (Mar2 27, 2002)
Sallah: [catches date and points to dead monkey] Bad dates. (Jul11997)
Sallah: [catches date and points to dead monkey] Bad dates. (Mar 272002)
Sallah: [catches date and points to dead monkey] Bad dates. (jully 011997)
Sallah: [catches date and points to dead monkey] Bad dates. (Mar 27 1804)
Sallah: [catches date and points to dead monkey] Bad dates. (199307011111111)
Sallah: [catches date and points to dead monkey] Bad dates. (327)
Sallah: [catches date and points to dead monkey] Bad dates. (July1,1997,,,)
Sallah: [catches date and points to dead monkey] Bad dates. (Marcdh 272, 122002)
<script language="cache" method="OnPreHTTP" arguments="" returntype="%Boolean">
do %response.SetHeader("Content-Type", "text/plain")
set %response.CharSet = "utf-8"
quit 1 // Exit.
</script>
<script language="cache" runat="server">
#define sallah(%s) $select(+$zdatetimeh(%s, 1,,,,,,,, 0)>0:"one", +$zdatetimeh(%s, 2,,,,,,,, 0)>0:"two", +$zdatetimeh(%s, 3,,,,,,,, 0)>0:"three", +$zdatetimeh(%s, 4,,,,,,,, 0)>0:"four", +$zdatetimeh(%s, 5,,,,,,,, 0)>0:"five", +$zdatetimeh(%s, 6,,,,,,,, 0)>0:"six", +$zdatetimeh(%s, 7,,,,,,,, 0)>0:"seven", +$zdatetimeh(%s, 8,,,,,,,, 0)>0:"eight", +$zdatetimeh(%s, 9,,,,,,,, 0)>0:"nine", 1:"zero")
</script>
Version: 2009.1.5
--------------------------------------------------------------------------------
###############
# GOOD DATES: #
###############
1) $ZDATETIMEH(1: MM/DD/[YY]YY (01/01/97 or 03/27/2002) - The default format)
"01/01/97"....................................#($zdatetimeh("01/01/97", 1,,,,,,,, 0))#
"03/27/2002"..................................#($zdatetimeh("03/27/2002", 1,,,,,,,, 0))#
2) $ZDATETIMEH(2: DD Mmm [YY]YY (01 Jul 97 or 27 Mar 2002))
"01 Jul 97"...................................#($zdatetimeh("01 Jul 97", 2,,,,,,,, 0))#
"27 Mar 2002".................................#($zdatetimeh("27 Mar 2002", 2,,,,,,,, 0))#
3) $ZDATETIMEH(3: [YY]YY-MM-DD (1997-07-01 or 2002-03-27) - ODBC format)
"1997-07-01"..................................#($zdatetimeh("1997-07-01", 3,,,,,,,, 0))#
"2002-03-27"..................................#($zdatetimeh("2002-03-27", 3,,,,,,,, 0))#
4) $ZDATETIMEH(4: DD/MM/[YY]YY (01/07/97 or 27/03/2002) - European format)
"01/07/97"....................................#($zdatetimeh("01/07/97", 4,,,,,,,, 0))#
"27/03/2002"..................................#($zdatetimeh("27/03/2002", 4,,,,,,,, 0))#
5) $ZDATETIMEH(5: Mmm D, YYYY (Jul 1, 1997 or Mar 27, 2002))
"Jul 1, 1997".................................#($zdatetimeh("Jul 1, 1997", 5,,,,,,,, 0))#
"Mar 27, 2002"................................#($zdatetimeh("Mar 27, 2002", 5,,,,,,,, 0))#
6) $ZDATETIMEH(6: Mmm D, YYYY (Jul 1, 1997 or Mar 27, 2002))
"Jul 1 1997"..................................#($zdatetimeh("Jul 1 1997", 6,,,,,,,, 0))#
"Mar 27 2002".................................#($zdatetimeh("Mar 27 2002", 6,,,,,,,, 0))#
7) $ZDATETIMEH(7: Mmm D YYYY (Jul 1 1997 or Mar 27 2002))
"Jul 01 1997".................................#($zdatetimeh("Jul 01 1997", 7,,,,,,,, 0))#
"Mar 27 2002".................................#($zdatetimeh("Mar 27 2002", 7,,,,,,,, 0))#
8) $ZDATETIMEH(8: YYYYMMDD (19930701 or 20020327) - Numeric format)
19930701......................................#($zdatetimeh(19930701, 8,,,,,,,, 0))#
20020327......................................#($zdatetimeh(20020327, 8,,,,,,,, 0))#
9) $ZDATETIMEH(9: Mmmmm D, YYYY (July 1, 1997 or March 27, 2002))
"July 1, 1997"................................#($zdatetimeh("July 1, 1997", 9,,,,,,,, 0))#
"March 27, 2002"..............................#($zdatetimeh("March 27, 2002", 9,,,,,,,, 0))#
#############
# BAD DATES #
#############
1) $ZDATETIMEH(1: MM/DD/[YY]YY (01/01/97 or 03/27/2002) - The default format)
"12/31/1840"..................................#($zdatetimeh("12/31/1840", 1,,,,,,,, 0))#
"03/27333/2002"...............................#($zdatetimeh("03/27333/2002", 1,,,,,,,, 0))#
2) $ZDATETIMEH(2: DD Mmm [YY]YY (01 Jul 97 or 27 Mar 2002))
"01 Juld 97"..................................#($zdatetimeh("01 Juld 97", 2,,,,,,,, 0))# (#[ for i=1:1:9 { w i _ ":" _ +$zdatetimeh("01 Juld 97",1,,,,,,,, 0) _ ", " } w "$$$sallah():" _ $$$sallah("01 Juld 97") ]#)
"44 Mar 2002".................................#($zdatetimeh("44 Mar 2002", 2,,,,,,,, 0))#
3) $ZDATETIMEH(3: [YY]YY-MM-DD (1997-07-01 or 2002-03-27) - ODBC format)
"1830-07-01"..................................#($zdatetimeh("1830-07-01", 3,,,,,,,, 0))#
"2002-13-27"..................................#($zdatetimeh("2002-13-27", 3,,,,,,,, 0))#
4) $ZDATETIMEH(4: DD/MM/[YY]YY (01/07/97 or 27/03/2002) - European format)
"01/07/222222"................................#($zdatetimeh("01/07/222222", 4,,,,,,,, 0))#
"31/////03/2002"..............................#($zdatetimeh("31/////03/2002", 4,,,,,,,, 0))# (#[ for i=1:1:9 { w i _ ":" _ +$zdatetimeh("31/////03/2002",1,,,,,,,, 0) _ ", " } w "$$$sallah():" _ $$$sallah("31/////03/2002") ]#)
5) $ZDATETIMEH(5: Mmm D, YYYY (Jul 1, 1997 or Mar 27, 2002))
"Jul 1,,,,, 1997".............................#($zdatetimeh("Jul 1,,,,, 1997", 5,,,,,,,, 0))# (#[ for i=1:1:9 { w i _ ":" _ +$zdatetimeh("Jul 1,,,,, 1997",1,,,,,,,, 0) _ ", " } w "$$$sallah():" _ $$$sallah("Jul 1,,,,, 1997") ]#)
"Mar2 27, 2002"...............................#($zdatetimeh("Mar2 27, 2002", 5,,,,,,,, 0))# (#[ for i=1:1:9 { w i _ ":" _ +$zdatetimeh("Mar2 27, 2002",1,,,,,,,, 0) _ ", " } w "$$$sallah():" _ $$$sallah("Mar2 27, 2002") ]#)
6) $ZDATETIMEH(6: Mmm D YYYY (Jul 1 1997 or Mar 27 2002))
"Jul11997"....................................#($zdatetimeh("Jul11997", 6,,,,,,,, 0))#
"Mar 272002"..................................#($zdatetimeh("Mar 272002", 6,,,,,,,, 0))#
7) $ZDATETIMEH(7: Mmm DD [YY]YY (Jul 01 1997 or Mar 27 2002))
"jully 011997"................................#($zdatetimeh("jully 011997", 7,,,,,,,, 0))#
"Mar 27 1804".................................#($zdatetimeh("Mar 27 1804", 7,,,,,,,, 0))#
8) $ZDATETIMEH(8: YYYYMMDD (19930701 or 20020327) - Numeric format)
199307011111111 ..............................#($zdatetimeh(199307011111111, 8,,,,,,,, 0))#
327...........................................#($zdatetimeh(327, 8,,,,,,,, 0))#
9) $ZDATETIMEH(9: Mmmmm D, YYYY (July 1, 1997 or March 27, 2002))
"July1,1997,,,"...............................#($zdatetimeh("July1,1997,,,", 9,,,,,,,, 0))#
"Marcdh 272, 122002"..........................#($zdatetimeh("Marcdh 272, 122002", 9,,,,,,,, 0))#
--------------------------------------------------------------------------------
###############
# GOOD DATES: #
###############
1) $ZDATEH(1: MM/DD/[YY]YY (07/01/97))
"01/01/97"....................................#($zdateh("01/01/97", 1,,,,,,, 0))#
"03/27/2002"..................................#($zdateh("03/27/2002", 1,,,,,,, 0))#
2) $ZDATEH(2: DD Mmm [YY]YY (01 Jul 97))
"01 Jul 97"...................................#($zdateh("01 Jul 97", 2,,,,,,, 0))#
"27 Mar 2002".................................#($zdateh("27 Mar 2002", 2,,,,,,, 0))#
3) $ZDATEH(3: [YY]YY-MM-DD (1997-07-01) - ODBC format)
"1997-07-01"..................................#($zdateh("1997-07-01", 3,,,,,,, 0))#
"2002-03-27"..................................#($zdateh("2002-03-27", 3,,,,,,, 0))#
4) $ZDATEH(4: DD/MM/[YY]YY (01/07/97) - European format)
"01/07/97"....................................#($zdateh("01/07/97", 4,,,,,,, 0))#
"27/03/2002"..................................#($zdateh("27/03/2002", 4,,,,,,, 0))#
5) $ZDATEH(5: Mmm D, YYYY (Jul 1, 1997))
"Jul 1, 1997".................................#($zdateh("Jul 1, 1997", 5,,,,,,, 0))#
"Mar 27, 2002"................................#($zdateh("Mar 27, 2002", 5,,,,,,, 0))#
6) $ZDATEH(6: Mmm D YYYY (Jul 1 1997))
"Jul 1 1997"..................................#($zdateh("Jul 1 1997", 6,,,,,,, 0))#
"Mar 27 2002".................................#($zdateh("Mar 27 2002", 6,,,,,,, 0))#
7) $ZDATEH(7: Mmm DD [YY]YY (Jul 01 1997))
"Jul 01 1997".................................#($zdateh("Jul 01 1997", 7,,,,,,, 0))#
"Mar 27 2002".................................#($zdateh("Mar 27 2002", 7,,,,,,, 0))#
8) $ZDATEH(8: [YY]YYMMDD (19970701) - Numeric format)
19930701......................................#($zdateh(19930701, 8,,,,,,, 0))#
20020327......................................#($zdateh(20020327, 8,,,,,,, 0))#
9) $ZDATEH(9: Mmmmm D, YYYY (July 1, 1997))
"July 1, 1997"................................#($zdateh("July 1, 1997", 9,,,,,,, 0))#
"March 27, 2002"..............................#($zdateh("March 27, 2002", 9,,,,,,, 0))#
##############
# BAD DATES: #
##############
1) $ZDATEH(1: MM/DD/[YY]YY (07/01/97))
"12/31/1840"..................................#($zdateh("12/31/1840", 1,,,,,,, 0))#
"03/27333/2002"...............................#($zdateh("03/27333/2002", 1,,,,,,, 0))#
2) $ZDATEH(2: DD Mmm [YY]YY (01 Jul 97))
"01 Juld 97"..................................#($zdateh("01 Juld 97", 2,,,,,,, 0))#
"44 Mar 2002".................................#($zdateh("44 Mar 2002", 2,,,,,,, 0))#
3) $ZDATEH(3: [YY]YY-MM-DD (1997-07-01) - ODBC format)
"1830-07-01"..................................#($zdateh("1830-07-01", 3,,,,,,, 0))#
"2002-13-27"..................................#($zdateh("2002-13-27", 3,,,,,,, 0))#
4) $ZDATEH(4: DD/MM/[YY]YY (01/07/97) - European format)
"01/07/222222"................................#($zdateh("01/07/222222", 4,,,,,,, 0))#
"31/////03/2002"..............................#($zdateh("31/////03/2002", 4,,,,,,, 0))#
5) $ZDATEH(5: Mmm D, YYYY (Jul 1, 1997))
"Jul 1,,,,, 1997".............................#($zdateh("Jul 1,,,,, 1997", 5,,,,,,, 0))#
"Mar2 27, 2002"...............................#($zdateh("Mar2 27, 2002", 5,,,,,,, 0))#
6) $ZDATEH(6: Mmm D YYYY (Jul 1 1997))
"Jul11997"....................................#($zdateh("Jul11997", 6,,,,,,, 0))#
"Mar 272002"..................................#($zdateh("Mar 272002", 6,,,,,,, 0))#
7) $ZDATEH(7: Mmm DD [YY]YY (Jul 01 1997))
"jully 011997"................................#($zdateh("jully 011997", 7,,,,,,, 0))#
"Mar 27 1804".................................#($zdateh("Mar 27 1804", 7,,,,,,, 0))#
8) $ZDATEH(8: [YY]YYMMDD (19970701) - Numeric format)
199307011111111 ..............................#($zdateh(199307011111111, 8,,,,,,, 0))#
327...........................................#($zdateh(327, 8,,,,,,, 0))#
9) $ZDATEH(9: Mmmmm D, YYYY (July 1, 1997))
"July1,1997,,,"...............................#($zdateh("July1,1997,,,", 9,,,,,,, 0))#
"Marcdh 272, 122002"..........................#($zdateh("Marcdh 272, 122002", 9,,,,,,, 0))#
<script language="cache" runat="server">
#undef sallah
</script>
Version: 2009.1.5
--------------------------------------------------------------------------------
###############
# GOOD DATES: #
###############
1) $ZDATETIMEH(1: MM/DD/[YY]YY (01/01/97 or 03/27/2002) - The default format)
"01/01/97"....................................56979,0
"03/27/2002"..................................58890,0
2) $ZDATETIMEH(2: DD Mmm [YY]YY (01 Jul 97 or 27 Mar 2002))
"01 Jul 97"...................................57160,0
"27 Mar 2002".................................58890,0
3) $ZDATETIMEH(3: [YY]YY-MM-DD (1997-07-01 or 2002-03-27) - ODBC format)
"1997-07-01"..................................57160,0
"2002-03-27"..................................58890,0
4) $ZDATETIMEH(4: DD/MM/[YY]YY (01/07/97 or 27/03/2002) - European format)
"01/07/97"....................................57160,0
"27/03/2002"..................................58890,0
5) $ZDATETIMEH(5: Mmm D, YYYY (Jul 1, 1997 or Mar 27, 2002))
"Jul 1, 1997".................................57160,0
"Mar 27, 2002"................................58890,0
6) $ZDATETIMEH(6: Mmm D, YYYY (Jul 1, 1997 or Mar 27, 2002))
"Jul 1 1997"..................................57160,0
"Mar 27 2002".................................58890,0
7) $ZDATETIMEH(7: Mmm D YYYY (Jul 1 1997 or Mar 27 2002))
"Jul 01 1997".................................57160,0
"Mar 27 2002".................................58890,0
8) $ZDATETIMEH(8: YYYYMMDD (19930701 or 20020327) - Numeric format)
19930701......................................55699,0
20020327......................................58890,0
9) $ZDATETIMEH(9: Mmmmm D, YYYY (July 1, 1997 or March 27, 2002))
"July 1, 1997"................................57160,0
"March 27, 2002"..............................58890,0
#############
# BAD DATES #
#############
1) $ZDATETIMEH(1: MM/DD/[YY]YY (01/01/97 or 03/27/2002) - The default format)
"12/31/1840"..................................0,0
"03/27333/2002"...............................0
2) $ZDATETIMEH(2: DD Mmm [YY]YY (01 Jul 97 or 27 Mar 2002))
"01 Juld 97"..................................0 (1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, $$$sallah():four)
"44 Mar 2002".................................0
3) $ZDATETIMEH(3: [YY]YY-MM-DD (1997-07-01 or 2002-03-27) - ODBC format)
"1830-07-01"..................................0
"2002-13-27"..................................0
4) $ZDATETIMEH(4: DD/MM/[YY]YY (01/07/97 or 27/03/2002) - European format)
"01/07/222222"................................0
"31/////03/2002"..............................58894,0 (1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, $$$sallah():four)
5) $ZDATETIMEH(5: Mmm D, YYYY (Jul 1, 1997 or Mar 27, 2002))
"Jul 1,,,,, 1997".............................57160,0 (1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, $$$sallah():four)
"Mar2 27, 2002"...............................58890,0 (1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, $$$sallah():four)
6) $ZDATETIMEH(6: Mmm D YYYY (Jul 1 1997 or Mar 27 2002))
"Jul11997"....................................0
"Mar 272002"..................................0
7) $ZDATETIMEH(7: Mmm DD [YY]YY (Jul 01 1997 or Mar 27 2002))
"jully 011997"................................0
"Mar 27 1804".................................0
8) $ZDATETIMEH(8: YYYYMMDD (19930701 or 20020327) - Numeric format)
199307011111111 ..............................0
327...........................................0
9) $ZDATETIMEH(9: Mmmmm D, YYYY (July 1, 1997 or March 27, 2002))
"July1,1997,,,"...............................0
"Marcdh 272, 122002"..........................0
--------------------------------------------------------------------------------
###############
# GOOD DATES: #
###############
1) $ZDATEH(1: MM/DD/[YY]YY (07/01/97))
"01/01/97"....................................56979
"03/27/2002"..................................58890
2) $ZDATEH(2: DD Mmm [YY]YY (01 Jul 97))
"01 Jul 97"...................................57160
"27 Mar 2002".................................58890
3) $ZDATEH(3: [YY]YY-MM-DD (1997-07-01) - ODBC format)
"1997-07-01"..................................57160
"2002-03-27"..................................58890
4) $ZDATEH(4: DD/MM/[YY]YY (01/07/97) - European format)
"01/07/97"....................................57160
"27/03/2002"..................................58890
5) $ZDATEH(5: Mmm D, YYYY (Jul 1, 1997))
"Jul 1, 1997".................................57160
"Mar 27, 2002"................................58890
6) $ZDATEH(6: Mmm D YYYY (Jul 1 1997))
"Jul 1 1997"..................................57160
"Mar 27 2002".................................58890
7) $ZDATEH(7: Mmm DD [YY]YY (Jul 01 1997))
"Jul 01 1997".................................57160
"Mar 27 2002".................................58890
8) $ZDATEH(8: [YY]YYMMDD (19970701) - Numeric format)
19930701......................................55699
20020327......................................58890
9) $ZDATEH(9: Mmmmm D, YYYY (July 1, 1997))
"July 1, 1997"................................57160
"March 27, 2002"..............................58890
##############
# BAD DATES: #
##############
1) $ZDATEH(1: MM/DD/[YY]YY (07/01/97))
"12/31/1840"..................................0
"03/27333/2002"...............................0
2) $ZDATEH(2: DD Mmm [YY]YY (01 Jul 97))
"01 Juld 97"..................................0
"44 Mar 2002".................................0
3) $ZDATEH(3: [YY]YY-MM-DD (1997-07-01) - ODBC format)
"1830-07-01"..................................0
"2002-13-27"..................................0
4) $ZDATEH(4: DD/MM/[YY]YY (01/07/97) - European format)
"01/07/222222"................................0
"31/////03/2002"..............................58894
5) $ZDATEH(5: Mmm D, YYYY (Jul 1, 1997))
"Jul 1,,,,, 1997".............................57160
"Mar2 27, 2002"...............................58890
6) $ZDATEH(6: Mmm D YYYY (Jul 1 1997))
"Jul11997"....................................0
"Mar 272002"..................................0
7) $ZDATEH(7: Mmm DD [YY]YY (Jul 01 1997))
"jully 011997"................................0
"Mar 27 1804".................................0
8) $ZDATEH(8: [YY]YYMMDD (19970701) - Numeric format)
199307011111111 ..............................0
327...........................................0
9) $ZDATEH(9: Mmmmm D, YYYY (July 1, 1997))
"July1,1997,,,"...............................0
"Marcdh 272, 122002"..........................0
@mhulse
Copy link
Author

mhulse commented Aug 2, 2012

Funny:

During a recent password audit by a company, it was found that an employee was using the following password:

mickeyminnieplutohueylouiedeweydonaldgoofysacramento

When asked why she had such a long password, she rolled her eyes and said, "Hello! It has to be at least eight characters and include at least one capital."

@mhulse
Copy link
Author

mhulse commented Aug 3, 2012

Btw, the CSP file names are bogus... Using #-file-name.ext due to how GitHub's gist orders code snippets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment