Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Long date to Short
#7
Thank you for your patience with me. I have converted your macro in english locale. It still gives an error at the date conversion statement:


Function Macro_180320a
Code:
Copy      Help
;www.quickmacros.com/forum/showthread.php?tid=6379
;str s.timeformat("{DD}")
str s.timeformat("{DD}" 0 WINAPI.LANG_ENGLISH|WINAPI.SUBLANG_ENGLISH_US)
out s
// remove day and comma from string
int i = find(s "," 0 1)
s.remove(0 i+1)
s.trim
out s
//convert to Date
DATE d1(s)
;Error (RT) in <open ":7772: /278">Macro_180320a:  0x80020005, Type mismatch.    <help #IDP_ERR>?
out d1
//convert to DateTime if needed
DateTime d.FromStr(s) ;;;directly from string
out d.ToStr(1)
DateTime d2.FromDATE(d1);;from Date
out d2.ToStr(1)

Let us put it in a simpler way. The following simple macro does not work and the explanation is give in thread www.quickmacros.com/forum/showthread.php?tid=679

Function Macro_180320b
Code:
Copy      Help
;www.quickmacros.com/forum/showthread.php?tid=679
str s="March 23, 2018"
DATE d1(s)

Nevertheless, the following one it works:
Function Macro_180320c
Code:
Copy      Help
str s="23/03/18"
DATE d1(s)
out d1

Best regards.


Messages In This Thread
Long date to Short - by ssimop - 03-08-2018, 11:51 AM
RE: Long date to Short - by Gintaras - 03-08-2018, 12:06 PM
RE: Long date to Short - by Gintaras - 03-08-2018, 12:09 PM
RE: Long date to Short - by Kevin - 03-20-2018, 06:56 PM
RE: Long date to Short - by ssimop - 03-20-2018, 07:57 PM
RE: Long date to Short - by Kevin - 03-22-2018, 04:48 AM
RE: Long date to Short - by ssimop - 03-23-2018, 01:21 AM
RE: Long date to Short - by Kevin - 03-23-2018, 03:37 AM
RE: Long date to Short - by Kevin - 03-23-2018, 06:16 AM
RE: Long date to Short - by Kevin - 03-26-2018, 06:53 AM
RE: Long date to Short - by ssimop - 03-26-2018, 07:15 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)