Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Long date to Short
#8
this code works on my pc every time.

Code:
Copy      Help
str s="March 23, 2018"
DATE d1(s)

Outputs
03/22/2018 

this code
str s.timeformat("{DD}")
out s
// remove day and comma from string
int i = find("," 0 1)
s.remove(0 i+1)
s.trim
out s
//convert to Date
DATE d1(s)
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)
Outputs

Thursday, March 22, 2018
March 22, 2018
03/22/2018
03/22/2018
03/22/2018 

if your output is not the same then its a language issue..


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)