Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
leading zeros in ToSTr
#1
Hi Gintaras,
In using DateTime functions I use this:

Macro Macro12
Code:
Copy      Help
DateTime x
x.FromComputerTime
out x.ToStr(1)

however it outputs day and month without leading zeros.
In sqlite, it is better for date time functions such as strftime to be in format with leading zeros
even better to have it in this format YYYY-MM-DD to use the sqlite date and datetime functions more directly without having to specify format with strftime
I know there are some formatting options that indicate no leading zero but they don't seem to work with my version of sqlite (the qm recommended sqlite.dll).
Any thoughts.
How would you convert the output from above (e.g. 9/3/2012) to YYYY-MM-DD format easily.
Thanks, S
#2
Macro Macro1793
Code:
Copy      Help
DateTime x
x.FromComputerTime
out x.ToStrFormat("{yyyy-MM-dd}")
#3
great that's perfect!
S


Forum Jump:


Users browsing this thread: 1 Guest(s)