User Tag List

Results 1 to 4 of 4

Thread: Todays date and time

  1. #1
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Todays date and time

    How do I get todays date with the current time?

    I've tried a date and time object with:
    Str$(year of( "Date & Time" ) ) + "-" + Str$(month of( "Date & Time" ) ) + "-" + Str$(day of month of( "Date & Time" ) ) + " " + Str$(hours of( "Date & Time" ) ) + ":" + Str$(minutes of( "Date & Time" ) ) + ":" + Str$(seconds of( "Date & Time" ) )

    It kinda works, but it misses leading zeros, i.e. "2014-07-21 09:05:03" is shown as "2014-7-21 9:5:3".

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you want a number to have leading Zeroes, you can do something like this:


    + Always set MyString to [ "000000"+Str$(<MyNumberHere>) ]
    + Always set AnotherString to Right(MyString, 2)

    If you wanted to, you could condense the expressions into one via something like this:

    + Always set MyString to Right("0000000"+Str$(<MyNumberHere>),2)

  3. #3
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes of course. I ended up using:
    Right("00"+Str$(<MyNumberHere>),2)

    Thanks!

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2016
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Basic code used, switch "HOURS" for what you wanted.
    Right$("00" + Str$(HOURS of( "Date & Time" )), 2)

    Or for the whole code:

    Str$(year of( "Date & Time" )) + Right$("00" + Str$(month of( "Date & Time" )), 2) + Right$("00" + Str$(day of month of( "Date & Time" )), 2) + Right$("00" + Str$(hours of( "Date & Time" )), 2) + Right$("00" + Str$(minutes of( "Date & Time" )), 2) + Right$("00" + Str$(seconds of( "Date & Time" )), 2)

    returns:
    20180912003034

    as in
    Year,Month,Day, Hour,Minutes,Seconds
    2018/09/12 00:30:34

    Although it's not the way humans format the date, such as having the year first, this order for date and time, insures math will always work when comparing timestamps.

    If you don't and instead put Month, Day, Year, then if you sort by dates, you will get 01/01/2018 then 01/01/2019 then 02/02/2018 since it sorts by the left most number first.

    I'm posting to this, because the code in the above examples wasn't working, and this is the post I found, so I want other people looking for the answer, to be able to simply copy/paste the code instead of getting a syntax error and having to go back to Google and search again.

Similar Threads

  1. [RC7] Date&Time Bug (MFA and APK)
    By Koji_Kabuto in forum Android Export Module Version 2.0
    Replies: 7
    Last Post: 25th April 2013, 01:53 AM
  2. [RC6] Date&Time Bug (MFA and APK)
    By Koji_Kabuto in forum Android Export Module Version 2.0
    Replies: 8
    Last Post: 4th April 2013, 12:26 PM
  3. [bug] Date&time object doesn't show date
    By qenio in forum Android Export Module Version 2.0
    Replies: 3
    Last Post: 19th March 2012, 09:49 PM
  4. date & time
    By xiero in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 6th November 2010, 10:28 PM
  5. Date and Time Events
    By Gimbabwe in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 25th December 2009, 12:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •