aldweb

Fermer I. aldweb

Fermer II. Gratuitiels PC

Fermer III. Gratuitiels Palm

Fermer IV. Partagiciels Palm

Fermer V. iziBasic Palm

Fermer VI. Connaissance Palm

Fermer VII. Ordinateur Poche

Fermer VIII. miniPortail

Spécial !



Version mobile
de l'aldweb Site

m.aldweb.com


Ni Français, ni Anglais ?

Essayez donc l'un de ces drapeaux :
[de] [es] [it] [pt]
Recherche




Météo / Spam / www

Météo Lyon


aldweb contre le SPAM


Newsletter
Pour avoir des nouvelles de ce site, inscrivez-vous à notre Newsletter.
S'abonner
Se désabonner
298 Abonnés
Sites web de la famille

Webmaster - Infos
News Amis
Visites

   visiteurs

   visiteurs en ligne

Sondage
Comment trouve-tu le nouvel habillage de l'aldweb Site ?
 
Superbe !
Joli
Moyen
Moche...
Résultats
forum.gifForum - iziBasic - Sujet n°994

Forum - Forum
iziBasic - iziBasic


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

actif  Sujet n° 994  Date Comparison

le 24/11/2004 @ 22:22
par Mike Featherstone

Anonyme



Before I go and write an overly complex routine to do this (), does anyone know of a simple way of comparing a pair of iziBasic date strings and determining which is the earlier?

Thanks

Mike
  Poster une réponse  Haut

[]   


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1
--------
le 24/11/2004 @ 23:05
par aldweb

Anonyme

visiteur
Hello Mike,

Nice to see you here

The easy way to compare two dates is to put them in this format:
YYYYMMDD (Year Month Day)
And if you want to compare time also:
YYYYMMDDHHmmss (Year Month Day Hour Minute Second)

Example:
' get 24/11/2004 today
D$­­­­=DATE$­­­­
' transform to 20041124
A$­­­­=RIGHT$­­­­(D$­­­­,4)+MID$­­­­(D$­­­­,4,2)+LEFT$­­­­(D$­­­­,2)


Now, you can compare it with any other date formated the same way.
Example:
B$­­­­="20041201"
IF A$­ ­­­< B$­­­­ THEN
PRINT "Normal!"
ELSE
PRINT "Strange..."
ENDIF


I hope my answer helps you

Cheers,

@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2
--------
le 24/11/2004 @ 23:56
par Mike Featherstone

Anonyme

visiteur
Thanks.

I thought that was the format to use but string manipulation has never been my strong point and I couldn't think my way through it.

I would have ended up with a series of integer conversions - doing things the *very* long way round.


Having written a review that said 'I have a use for iziBasic', I thought it time to go and use it for real!
  Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3
--------
le 25/11/2004 @ 22:07
par aldweb

Anonyme

visiteur
I think that it is worth writing it for our friendly iziBasic fellows, Mike's great review is here:
http://www.clieuk.co.uk/izibasic.shtml/

Thanks again Mike for this review. For me, this is a great reward to my work.

Cheers

@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 4
--------
le 26/11/2004 @ 05:20
par Chuck

Anonyme

visiteur
I tried similar date manipulation and the MID$­­ function kept returning a null string. I worked around it by using LEFT$­­ to cut off the string on the right and then RIGHT$­­ to pick off the part I needed.
  Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 5
--------
le 26/11/2004 @ 21:50
par Mike Featherstone

Anonyme

visiteur
You're right - 24/04/2004 is returning 200424 rather than 20040424. MID$­­ seems to be malfunctioning.
Ecrire à Mike Featherstone   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 6
--------
le 26/11/2004 @ 21:53
par aldweb

Anonyme

visiteur
Thank you guys for the information.
I will check for the bug and work on a fix.

Cheers

@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 7
--------
le 26/11/2004 @ 23:19
par aldweb

Anonyme

visiteur
MID$­­­ is running fine.
It is just a misunderstanding and my own initial mistake given in my sample source code when answering to Mike.

Structure is:
MID$­­­(var$­­­,1st character,last character)
and not
MID$­­­(var$­­­,1st character,nb of characters)

So, my example becomes:
' get 24/11/2004 today
D$­­­­­­­=DATE$­
­­­­­­' transform to 20041124
A$­­­­­­­=RIGHT$­­­­­­­(D$­­­­­­­,4)+MID$­­­­­­­(D$­­­­­­­,4,5)+LEFT$­­­­­­­(D$­­­­­­­,2)


Sorry for the mistake.

@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 8
--------
le 26/11/2004 @ 23:32
par aldweb

Anonyme

visiteur
Me again: I just checked and I can tell that last character is not BASIC's standard. I will change this to nb of characters in next release.

So, at the end, it's my mistake anyway

@+
aldweb
Ecrire à aldweb   Poster une réponse  Haut

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 9
--------
le 26/11/2004 @ 23:38
par Mike Featherstone

Anonyme

visiteur
Thanks for the help. I'll use the iziBasic standard for now!
Ecrire à Mike Featherstone   Poster une réponse  Haut
actif sujet actif   clos sujet clos   Important! Important!   Nouveau Nouveau message   -   Rectifier Rectifier message   Clôturer Clôturer sujet   Remonter Remonter
[]
Catégories de discussion  Forum 



 
^ Haut ^