how to convert date

Hi,

I'm looking for some method to convert mail date, in format:
eg. "Sun, 18 Sep 2005 20:57:08 +0200", to computer local time.
I tried CTime but without resoults.

m.

0
10/13/2005 9:43:47 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
3077 Views

Similar Articles

[PageSpeed] 53

Have you tried COleDateTime::ParseDateTime()?

m.wski21.usunto@aust.com wrote:
> Hi,
>
> I'm looking for some method to convert mail date, in format:
> eg. "Sun, 18 Sep 2005 20:57:08 +0200", to computer local time.
> I tried CTime but without resoults.
> 
> m.

0
10/13/2005 12:31:34 PM
>I'm looking for some method to convert mail date, in format:
>eg. "Sun, 18 Sep 2005 20:57:08 +0200", to computer local time.
>I tried CTime but without resoults.

For the offset, I've used code like this:

pStr is pointing initially to the end of the string...

/* The last 5 characters are the time zone "+HHMM" */
/* Get the minutes */
const int Mins = atoi( &pStr[Len-2] );
/* Now get the hours */
pStr[Len-2] = '\0';
Len -= 2;
const int Hours = atoi( &pStr[Len-2] );
/* Eliminate the hours */
pStr[Len-2] = '\0';
Len -= 2;
const bool bPlusMinus = pStr[Len-1] == '-' ? false : true;

And then used the InternetTimeToSystemTime API for the main part of
the string. 

Dave
-- 
MVP VC++ FAQ: http://www.mvps.org/vcfaq
0
davidl7375 (2060)
10/13/2005 1:17:28 PM
but this not convert this time to my geographic time,
so  what i must add?
Becouse this is my main problem, how to convert the time from server in
Asia to time in Europe(on local machine)?

0
10/13/2005 2:58:33 PM
>but this not convert this time to my geographic time,
>so  what i must add?

Have you added/subtracted the Hours/Mins offset to the value returned
by the InternetTimeToSystemTime API?

Dave
-- 
MVP VC++ FAQ: http://www.mvps.org/vcfaq
0
davidl7375 (2060)
10/13/2005 3:33:12 PM
Hi,

I thought that I find out some API method which could calculate this
automatical.
But you are talking that I must add/substract some hours/mins to this
returned value?
But from where can I take this value to add, mayeby I must use some
addition table ? 

m.

0
10/14/2005 6:19:45 AM
>I thought that I find out some API method which could calculate this
>automatical.

I couldn't find one when I looked.

>But you are talking that I must add/substract some hours/mins to this
>returned value?

Yes - see the code snippet I showed. Have you added/subtracted the
Hours and Mins values?

Dave
-- 
MVP VC++ FAQ: http://www.mvps.org/vcfaq
0
davidl7375 (2060)
10/14/2005 6:35:53 AM
Reply:

Similar Artilces:

Help with computing date\Time between previous record
I am trying to calculate how long it has been from a previous visit. I am tracking visit dates for customers. So I am sorting visit dates by customer. I want to look at a record date and subtract the previous reocrds date from it for all dates in the db. So in the end there is another Field that shows how long it has been bewteen customer visits? Dave K Use in your query: Datediff("d",[firstdatefield],[seconddatefield]) The "D" is for days. -- Milton Purdy ACCESS State of Arkansas "Dave" wrote: > I am trying to calculate how lo...

PivotTable
Hi, I was wondering if there was any way to get a range or multiple dates when you filter using a pivottable. As it is right now, There is "All", "Blank" and each individual date but not the ability to pick multiple dates or a date range (12/1 - 12/31) I currently am running the spreadsheet from Microsoft Office XP 1. Make sure the dates are excel dates (numeric) then after applying the pivot right click a date in the pivot table and select group, then group by day AND month -- Regards, Peo Sjoblom "Z" <arthursdomain@gmail.com> wrote in message news...

Date/Text Formatting
Hi, I have a column with in date format and would like to get this into a text format as follows : Column would say : 01/03/04 I want text to say : 'The month is March' Any help would be appreciated... Thanks Tappie One way .. Assuming dates are in col A, A1 down Put in B1: ="The month is "&CHOOSE(MONTH(A1),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oc t","Nov","Dec") Copy down -- Rgds Max xl 97 --- Please respond in thread xdeme...

Automatic Populate Todays Date in Cell when File is Saved.
I am creating a user data entry spreadsheet in excel and I want to record the date in a specific field when the excel file is opened. I need the field "Submit Date" to be automatically populated and protected when a user opens the file and performs a save. If the user does not Save the file the date field should remain empty. Can anyone help with this please? Paste the following macro into the Workbook module. You access the Workbook module by right-clicking on the Excel icon to the left of the word "File" in the menu across the top of the spreadsheet, select View C...

Date prompt appearing twice due to chart in report
Hi All, I am creating a report based on a query. I have a prompt to ask for the Beginning Date and the Ending Date. When I run the query I get the correct results. I also get the correct results when I run the report. However, I have just added a pie chart in my report footer, and because of this, I am always forced to enter the beginning and ending dates twice when running the report. What do I need to do to make the prompt only appear 1 time for each date? Thank you! decklun The prompt appears each time Access needs to run the query. Once for the report and a second time for ...

Converting email body and attachement to a PDF before sending
Howdy; I have an application that automatically creates email with the body of the email containing text/data formatted with HTML. Before sending the email, I would like to convert these to a PDF and then send the emails to the recipient. I am hoping there is some sort of VBA script that will allow me to streamline with as few steps as possible. Geoff. Office includes no components to convert documents to PDF files. I'm = sure there are tools out there that are programmable -- you could even = program the PDF makers that work as printer drivers if you create the = original document i...

Count of Weekdays Between Two Dates
Task: With a given start date and end date, print a list of Months showing a count of weekdays and weekend days in each. It seemed like such a simple request... but how to get started? If I already had a table of all dates between the start and end dates, I'd have it whipped. Any thoughts appreciated. -- croy Here are some ideas you can use for this. First, you need to know how may days are in the month. Then you can use the function below to return the number of work days in the month. The subtract the work days from the number of days, and it will return the week end days. ...

dATES IN BOXES
hi All: THis is just killing me; why is it that when I enter in a number into my spreadsheet the it comes up with month attached. For examply when I enter in the number 4 it populates the field with 4-Jan. Please help this is just a real pain in the asss Mark, Does this happen in every cell or just a few. The formatting of the cell is probably set to a date format. Select the problematic cells, go to the Format menu, choose Cells, then the Number tab, and choose General. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com chi...

email date stamp
hello all Can you tell me whether there is anyway to change the Outlook email stamp to a different format All emails from everyone all seem to have the following format Sent: Wednesday, August 23, 2006 6:10 PM for recording when the email was sent. All emails I send use the same format. A colleague of mine has told me that he can make Outlook stamp all his outgoing emails with the following format: Sent: 2006-08-21 05:28 Can individuals control this? if so how? In your display? View-> Arrange By-> Current View-> Customize Current View-> Format Columns... -- Robert Sparn...

Can I convert a publisher file to a Adobe PDF? #2
Can I convert a publisher file to a Adobe PDF? I hear an echo.................. -- JoAnn Paules MVP Microsoft [Publisher] "Mel" <Mel@discussions.microsoft.com> wrote in message news:A31BB3DC-8E27-41FB-9CAA-632F58580608@microsoft.com... > Can I convert a publisher file to a Adobe PDF? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.788 / Virus Database: 533 - Release Date: 11/1/2004 It's a good idea to wait at least a day after posting. News Groups are "world wide" and the individua...

Date expressions
Hello I am just wondering if there is an easy way that an expression can be used to calculate the number of days in a month? Any assistance would be greatly appreciated Thank you in advance AC well, the number of days in a month can change - specifically, the number of days in February, depending on what year it is. for the number of days in a *specific month of a specific year*, the following will work, as Public Function isDaysCount(ByVal dat As Date) As Integer Dim dat2 As Date dat2 = DateAdd("m", 1, dat) isDaysCount = DateDiff("d", DateSerial(Year...

Want to avoid pasted text becoming dates
Occasionally, I will paste from a table arrangement on a website. Sometimes, this data will contain text that has some characteristics of a date, eg, 3/16 as a fraction. I could live with it becoming 0.1875, but not March 16, 2005. How can I prevent Excel's intelligence from overcoming my stupidity <g>. TIA, George One work-around is to paste into notepad. Save that file as *.txt Then open that text file in excel. You'll be prompted by the text import wizard for how you want each field. GeorgeB wrote: > > Occasionally, I will paste from a table arrangement on a w...

Archive Modified date
QQ, I have just moved users from one mail server to another. Now, archiving no longer works. I looked at this and found out that archiving works with modified dates and since this was changed recently I am stuck. Do you guys have any idea, if their is a work around for this. Users have lots of sub folders. Thanks B Not really...you can manually archive by dragging and dropping items to the archive folders, or you might be able to use one of the 3rd party solutions listed at http://www.slipstick.com/addins/housekeeping.htm. -- Jocelyn Fiorello MVP - Outlook *** Messages sent to m...

Date Calculations
I have to create a formula in excel that takes a date (4-1-2010) and subtracts another date from it (2-1-2008) and gives me the remainder of months. Any ideas? How do you define a month difference? 30 days? Calendar months? What about months with different numbers of days. E.g., how many months between 28-Feb and 31-March. 1? 1+3/30? You need to define how the months should be calculated. At its simplest, just subtract one date from the other and divide by 30. That will give one of several possible answers. Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel,...

convert into time format
hi I want to make a simple timetabel for my employees. Instead of time format mm:ss I would like them just to type 1000 as in 10:00. I cannot find the right way, and do not have expert skills in Excel. pls. help. Henrik. Cannot be done in Excel simply by formatting the cells. You would have to use an adjacent column as a helper column with formulas to make the change to time. Chip Pearson has event code for quick entry of dates/times. http://www.cpearson.com/excel/DateTimeEntry.htm Or an add-in from Bob Phillips' site http://www.xldynamic.com/source/xld.QDEDownload.html Gord Dibb...

Subquery with Max(date)
I have a result set that I need to filter down to the last date something was done. The problem is that I can't seem to use the derived table in the From clause of my Subquery. The Query looks something like: SELECT sFirstname, sLastName, nProductID, VisitDate, dVisitDate FROM ( SELECT P.sFirstName, P.sLastName, PE.nProductID, CONVERT(varchar,PE.dVisitDate,101), PE.dVisitDate From Person P Join PersonEvent PE on P.PersonID = PE.PersonID WHERE ... ) AS A WHERE dStart = (Select Max(dStart) fro...

Convert Access 2007 to 2003 errors
I developed an Access database in access 2007 with multiple functions extracting from and exporting into Excel worksheets. Then I found out the user was incorrect in thinking they had Office 2007, they have Office 2003, and had downloaded a converter for Word and Excel 2007 files. I converted the database to Access 2003 and it runs OK in Access 2007, but on a test machine with only Office 2003 got multiple errors. I was able to solve most of the reference problems by manipulating which references were checked. But: Combos do not show any data even though the query in the row...

A Template or a Macro with the current date
Hi, Can i add the current date to a new template of a new macro? That is, i want to have a template where the current date is already mentioned.(or a macro that added the current date together with other features) When i tried to replay a macro of the add current date shortcut (ctrl+;) it added the same date that was recorded already and not the current one. Thanks a lot, Iris. Iris One way: Range("A1") = Date HTH Otto "iris" <sassonir@bgumail.bgu.ac.il> wrote in message news:18fcd0e0.0309291307.8079802@posting.google.com... > Hi, > > Can i add the ...

simple date and time functions
Hello. I am trying to compare the difference between two dates and times based on a 24 hour structure, including the NETWORKDAYS function. We work on a 48 hour turn around. Document comes in at 10:00 on 12-06-2005 and out 12:00 12-08-2005 then "no" else "yes". Specific formatting for dates and times seem to be an issue in NETWORKDAYS where I get the correct date calculation, but when I enter in the holidays, it returns a VALUE#. I have used mm-dd-yyyy. Thanks in advance for your help. How about =IF(networkdays(A20,A21)-(MOD(A20,1)-MOD(A21,1))>=2,"yes",&q...

messages stuck in outbox dated before I purchased computer at Wal
How can I delete all messages stuck in the outbox? I always get a pop up message that messages are stuck in outbox and I don't know how to delete those messages.Now I have trouble sending e mail to my atty @ warhola law@ yahoo.com Right-click on your error message, copy, then paste it into a reply = here. We can't do much troubleshooting without the complete error message. What happens when you try deleting the messages in the Outbox folder? In a pinch you can always send via webmail (using your browser). --=20 Gary VanderMolen, Microsoft MVP (Mail) http://mvp.sup...

Automatically Updating Task Start Dates
I'm off and running on my first construction project using Project 2007. I set almost all of my tasks up using the contraint type of "As Soon As Possible". I believe almost everything I read instructed me to do so to allow Project to modify the start dates itself. The construction project started last Thursday and we are moving right along. Some items have been completed sooner than expected, others are right on track, and others are lagging a bit behind. I have gone in and marked those items that are 100% complete and if they started sooner than expected I m...

convert a recalled quote into a layaway
store operations let you convert for a quote into a layaway and a layaway into a quote, but once you save that quote, store operations can not do it again with the same quote once you save it and recall it. since many goods are by default especial order or expensive items layaways over saved quotes are something necessary in multiple vertical markets ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, f...

Convert from HEX IDX
hi i have a database to convert but i don't know what fromat it is. I can actually see some of the text, so it seems to be not encypted. but for me too much hex code. my question: - is there a way to find out what format this is - is there a tool to analyze - is there a tool i could convert the data to .asc . txt .xls or mdb thanks a lot for your help there is an example of the raw text: i  ���� @  � � � �  �  c w Z � � U*  ? - $ �� a?Y   ~� :�  � �  � �  � �  � �  s u  s u 2 2 2 : 2 < �! " > �  > �  > �  x x  x x...

Calculating which day from date?
Is there a way to extract which day a specific dato represents? For example; 14.02.03 = Saturda -- Message posted from http://www.ExcelForum.com Hi one way: format the cell as 'DDDD' or =TEXT(A1,"dddd") where A1 stores your date value Frank > Is there a way to extract which day a specific dato represents? > > For example; 14.02.03 = Saturday > > > --- > Message posted from http://www.ExcelForum.com/ That did it though I got the wrong day... =UKEDAG(B5;2) 14.02.03 gives friday though it's supposed to be saturday... The name of the funct...

I need some help converting this to C++
[I would have asked this in a C++ forum but the one I found is empty!] System.IO.Directory.CreateDirectory(path); return System.IO.Directory.Exists(path); I want to bury this in a C++ Win32 Project. My effort so far (that does not work and I do not understand the error messages) is: #using <mscorlib.dll> using namespace System; using namespace System::IO; bool* _clrcall;bool CDirectory(String path) { DirectoryInfo d = Directory::CreateDirectory(path); return (d.Exists(path)); } I get Error 1 fatal error C1190: managed targeted code requires a '/c...