Re: [Lazarus] StrToDateTime question
On Sun, May 27, 2012 at 2:26 AM, Doug Edmunds dougedmu...@gmail.com wrote: Hello, How do I convert a string in the format -mm-dd to a DateTime variable? StrToDateTime('2012-05-26', ); // what goes there?// writeln(StrToDateTime('2012-05-26')); -dae -- __**_ Lazarus mailing list Lazarus@lists.lazarus.**freepascal.orgLazarus@lists.lazarus.freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarushttp://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] RE : StrToDateTime question
How do I convert a string in the format -mm-dd to a DateTime variable? StrToDateTime('2012-05-26', ); // what goes there?// The second parameter is only needed when '2012-05-26' is not in your locale date format. The way you use it is: var FS:TFormatSettings; dt:tdatetime; begin FS:=DefaultFormatSettings; FS.DateSeparator:='-'; FS.ShortDateFormat:='-mm-dd'; dt:=StrToDateTime('2012-05-26',FS); end. Note that specifying a ShortDateFormat of '-mm-dd' is not enough to set the DateSeparator to '-'. Ludo -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] StrToDateTime question
sorry, I understood that you wanted the opposite 2012/5/26 Doug Edmunds dougedmu...@gmail.com On 5/26/2012 6:30 PM, William Oliveira Ferreira wrote: FormatDateTime('-MM-DD', Now); How does that work with a string as input? -- __**_ Lazarus mailing list Lazarus@lists.lazarus.**freepascal.orgLazarus@lists.lazarus.freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarushttp://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- William de Oliveira Ferreira Bacharel em Sistemas de Informação -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus