Datum berechnen

Anfängerfragen zum Programmieren mit PureBasic.
gnaps
Beiträge: 151
Registriert: 02.09.2008 13:02

Datum berechnen

Beitrag von gnaps »

Hallo Forum,

ich sitze hier schon ein paar Tage und weis nicht wieter.

Ich benötig vom aktuellen Datum folgende bereiche

aktuelle Woche (hab ich)

Code: Alles auswählen

  heute.l=Date()
  tag.i=DayOfWeek(heute.l)
  If tag.i =0
    tag.i=7
  EndIf
  tag1.l=Date()-(86400*(tag.i-1))
  Debug FormatDate("%dd.%mm.%yyyy",tag1.l)
  tag2.l=Date()+(86400*(7-tag.i))
  Debug FormatDate("%dd.%mm.%yyyy",tag2.l)
letze Woche (hab ich)

Code: Alles auswählen

  heute.l=Date()
  tag.i=DayOfWeek(heute.l)
  If tag.i =0
    tag.i=7
  EndIf
  tag1.l=Date()-(86400*(tag.i-1))-(86400*7)
  Debug FormatDate("%dd.%mm.%yyyy",tag1.l)
  tag2.l=Date()+(86400*(7-tag.i)-(86400*7))
  Debug FormatDate("%dd.%mm.%yyyy",tag2.l)
wie bekomme ich den aktuellen Monat ?
wie bekomme ich den letzten Monat ?
wie bekomme ich das aktuellen Quartal ?
wie bekomme ich das letzte Quartal ?
wie bekomme ich das aktuelle Jahr ?
wie bekomme ich das letzte Jahr ?


Gruß gnaps
PureBasic Vollversion V 5.71 für Windows - Windows 10 (64)
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Re: Datum berechnen

Beitrag von ts-soft »

gnaps hat geschrieben:wie bekomme ich das aktuelle Jahr ?
wie bekomme ich das letzte Jahr ?

Code: Alles auswählen

Debug Year(Date())
Debug Year(Date()) - 1
Den Rest wirste jetzt wohl schaffen :wink:
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
gnaps
Beiträge: 151
Registriert: 02.09.2008 13:02

Re: Datum berechnen

Beitrag von gnaps »

Hi Forum,

danke an ts-soft

so einfach isses, alles perfekt umgesetzt.

Gruß
gnaps
PureBasic Vollversion V 5.71 für Windows - Windows 10 (64)
Antworten