For Programmers: Free Programming Magazines  


Home > Archive > Smartphone Developer Forum > January 2005 > How can I convert DATE variable used in POOM into String









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How can I convert DATE variable used in POOM into String
AndyCarr

2005-01-23, 4:04 pm

Hi,

How can I convert the DATE (double) variable returned from the POOM
function: IAppointment::get_Start() into a readable string?

This is what i'm doing currently (but doesn't work):

DATE date1;
TCHAR startdate[20];

HRESULT hr = IAppoint->get_Start(&date1);
wsprintf(startdate, TEXT("%f\0"), date1);
--
Thanks

Andy C
Peter Foot [MVP]

2005-01-23, 4:04 pm

You can use VariantTimeToSystemTime (see SDK for details) to convert to a
SYSTEMTIME struct. This has separate members for year, month, day etc which
you can use to create a date string.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

"AndyCarr" <acarr_fss@yahoo.co.uk> wrote in message
news:CF42A03E-7EC8-4311-91D4-479BF3C5F86F@microsoft.com...
> Hi,
>
> How can I convert the DATE (double) variable returned from the POOM
> function: IAppointment::get_Start() into a readable string?
>
> This is what i'm doing currently (but doesn't work):
>
> DATE date1;
> TCHAR startdate[20];
>
> HRESULT hr = IAppoint->get_Start(&date1);
> wsprintf(startdate, TEXT("%f\0"), date1);
> --
> Thanks
>
> Andy C



GG

2005-01-23, 4:04 pm

"AndyCarr" <acarr_fss@yahoo.co.uk> wrote in message
news:CF42A03E-7EC8-4311-91D4-479BF3C5F86F@microsoft.com...
> Hi,
>
> How can I convert the DATE (double) variable returned from the POOM
> function: IAppointment::get_Start() into a readable string?
>
> This is what i'm doing currently (but doesn't work):
>
> DATE date1;
> TCHAR startdate[20];
>
> HRESULT hr = IAppoint->get_Start(&date1);
> wsprintf(startdate, TEXT("%f\0"), date1);


I normally do this in two steps:

1) VariantTimeToSystemTime to convert the DATE into a SYSTEMTIME struct
2) GetDateFormat to create a string from the SYSTEMTIME struct

HTH,


--
Giuseppe Govi
g.govi <a> vodafone.it


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com