in reply to Re^5: Win32::GUI::Grid & Date Formats
in thread Win32::GUI::Grid & Date Formats
There was a cut&paste error which I fixed now.
Still doesn't work
BUT watch out, your test example is in M-d-yyyy format instead of d-M-yyyy.
Watch out for what? The default short date format in the US (my location) is M-d-yyyy. There are many date formats specific to different regions in the world however, from my experience, a universally accepted format is yyyy-M-dd. I have yet to find an example of yyyy-d-M which is what your code now turns the date into.
It's a good idea if you try to make the necessary change yourself, if that's the format you want to be the input.
My data is already in the format I need however the date format of the control is not (I need to set the format of the control). Re-formatting the string itself is easy
But that is not what I need to do.my $datein = "7-19-2005"; my ($month,$day,$year) = $datein =~ /(\d+)-(\d+)-(\d+)/; my $dateout = "$year-$month-$day"; $dateout =~ s/-(\d)-/-0$1-/; print "$dateout\n";
The purpose of perl monks is to offer guidance, rather than program for people.
Dude! That just kind of hit me the wrong way. I know that what you say is true but did I ask for someone to write this program for me? No. Did I post code that reproduces the problem? Yes. I am just looking for a way to acces the DateTime object in the Grid Cell object so that I can use the methods of the DateTime object. As far as I can tell, this is not documented or I just can't find the documentation for it. I even looked into the code in Grid.pm but I'll be the first to admit that some of that stuff is currently above my level of perl. I only asked for a hint and PerlMonks has a great reputation for being able to solve seemingly unsolvable problems.
But since you changed your post intead of just updating it, let me address the new post
But I coded it for d-M-yyyy instead of M-d-YYYY
Why? Did I specify d-MM-yyyy? I thought I specified M-d-yyyy as the beginning format.
I've been working on too many new anonymous monk posts recently and hadn't turned off the 'autopilot'.
In my opinion, if you are working on this site in "autopilot" mode, you shouldn't offer anything at all. And are "anonymous monk posts" less deserving than others? I don't think so. There have been many good discussions here that talk about what perlmonks is for and the right way to respond to questions. Perhaps you should read some of them. I know that my response here could be considered in bad taste and not the perlmonks way but I just had to speak my mind.
Chris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |